android-print-framework

Printing PDF directly using PrintManager Android 4.4

放肆的年华 提交于 2020-08-04 15:27:08
问题 http://developer.android.com/training/printing/index.html documentation tells how to print a custom content by rendering it on a PDF canvas and sending thus created PDF document for printing. But has no information about if we already have a PDF document, how to send it for printing? Does similar to bitmap printing, there is some method like printHelper.printPDF? 回答1: Use the following code fragment in your onWrite() method should do it: InputStream input = null; OutputStream output = null;

how to change android default printing dialog paper size?

只谈情不闲聊 提交于 2020-06-28 04:15:10
问题 I am using default android printer in my application i have followed this link to print the web view. it gets printing but my problem is when the print dialog opens the default page size is A4 , it is possible to change the paper size to A5 as default?? i tried in google but i can't find the answer, can anyone help me 回答1: After searching lot i got the answer , you have to change the PrinterAttributes Refer this link And i android code change is PrintAttributes.Builder builder = new

Google cloud print API integration in my application

最后都变了- 提交于 2020-01-06 05:52:07
问题 I am trying to integrate Google cloud print in Android Application. I do not want to do it through Print framework as my requirement is to directly print from application without any selection process. For this, I have integrate Google authentication and generate access token for that. I am trying to load printer list using access_token but getting error all the time. Following are my API call details: URL : https://www.google.com/cloudprint/search Type : POST Header : Authorization : OAuth

Print Pdf file via Bluetooth Printer Android

霸气de小男生 提交于 2019-12-20 17:28:04
问题 In My project Need to print Pdf file Via Bluetooth Printer. I write a code to print via pdf Its for fine for a Text, But I want to Print PDF file on Bluetooth printer. My java Code to Print Text @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv= (ListView) findViewById(R.id.listView1); // listdata(lv); try { // we are goin to have three buttons for specific functions Button openButton = (Button)

Print Pdf file via Bluetooth Printer Android

こ雲淡風輕ζ 提交于 2019-12-20 17:27:37
问题 In My project Need to print Pdf file Via Bluetooth Printer. I write a code to print via pdf Its for fine for a Text, But I want to Print PDF file on Bluetooth printer. My java Code to Print Text @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv= (ListView) findViewById(R.id.listView1); // listdata(lv); try { // we are goin to have three buttons for specific functions Button openButton = (Button)

Android: inflating a layout and writting it to PDF produces a blank PDF

假如想象 提交于 2019-12-18 08:32:31
问题 when the user selects a share button within an activity, I would like to inflate a layout, populate it, and then write that layout to a pdf using the new printing API. In my fragment I have @TargetApi(Build.VERSION_CODES.KITKAT) public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_share_context: LayoutInflator inflator = getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View container = inflator.inflate(R.layout

Android: inflating a layout and writting it to PDF produces a blank PDF

假如想象 提交于 2019-12-18 08:32:24
问题 when the user selects a share button within an activity, I would like to inflate a layout, populate it, and then write that layout to a pdf using the new printing API. In my fragment I have @TargetApi(Build.VERSION_CODES.KITKAT) public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_share_context: LayoutInflator inflator = getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View container = inflator.inflate(R.layout

How to Print PDF using Android 4.4 Printing framework [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 03:53:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . How to print already downloaded PDF using Android 4.4 printing framework? I viewed the developer documentation. but no luck. Any example would be helpful 回答1: After spend some hours on google i found the solution. PrintManager printManager = (PrintManager) this.getSystemService(Context.PRINT_SERVICE); String

Connect Printer to android device via wi - fi router

↘锁芯ラ 提交于 2019-12-12 13:21:51
问题 My printer and android device is connected to a Wi-Fi router. I need to print a text from my application which should be sent via the router to the printer. How to establish the connection? Note : i need not want to connect the printer directly. 回答1: I just searched for lot of links but there is no luck, what i did is go to printer settings change the port to TCP/IP and assign RAW port. By default you will get 9100, use this port number in the code with respective IP address of the printer.

Hide Android print dialog for Hp printers

梦想与她 提交于 2019-12-12 04:23:58
问题 I have developed an Android application which prints a photo using either PrintHelper or Hp mobile print SDK. However, when before the printing process, Android print Dialog comes up on the screen. How can I skip the android print dialog, when the application prints the photo ? I have already come across below questions. Briefly, the answers are "there is no way to do this." Print without print dialog Android Print from android without system dialog Is it possible to directly print content to