• ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
We have new content about printers, Click here to check it out!
Check some of the most frequent questions about Instant Ink: HP INSTANT INK, HP+ PLANS: INK AND TONER.


Check out our WINDOWS 11 Support Center info about: OPTIMIZATION, KNOWN ISSUES, FAQs AND MORE.
HP Recommended
Other

How can I implement borderless printing of PDFs in my Android application without relying on plugins? I need to ensure that when users print PDF documents through my app, the printed output has no borders or margins. How can I achieve this functionality within my app's printing feature?

3 REPLIES 3
HP Recommended

Hi @Tatarao,

 

Welcome to HP Support Community.

 

Thank you for posting your query, I will be glad to help you.

 

To achieve borderless printing of PDFs from your Android application without relying on plugins, you can utilize the Android Print Framework along with PDF rendering libraries. Here's a general outline of the steps you can follow.

 

  • PDF Rendering: Choose a PDF rendering library compatible with Android, such as PdfiumAndroid or AndroidPdfViewer. These libraries allow you to render PDF documents within your app.
  • Custom Print Document Adapter: Implement a custom PrintDocumentAdapter to handle the printing process. This adapter will be responsible for rendering the PDF content and preparing it for printing.
  • Set Print Attributes: Configure the print attributes to specify the desired print settings, including borderless printing. You can set attributes like media size, margins, and color mode.
  • Render PDF Content: Use the chosen PDF rendering library to render the PDF content onto the printed page. Ensure that the rendering process accounts for any necessary adjustments to achieve borderless printing.
  • Handle Printing: Implement the printing functionality in your app, allowing users to select a PDF document and initiate the printing process. Use the custom PrintDocumentAdapter to handle the printing task.
  • Test and Iterate: Test the printing functionality thoroughly to ensure that borderless printing works as expected on different devices and printer configurations.

 

I hope this helps.

 

Take care and have a good day.

 

Please click “Accepted Solution” if you feel my post solved your issue, it will help others find the solution. Click the “Kudos/Thumbs Up" on the bottom right to say “Thanks” for helping!

 

Alden4

HP Support 

Raj_05
HP Support Community Moderator
HP Recommended

Thank you for your response.
However, I would like to clarify that the Android Print Service does not include a specific option for borderless printing. While there are options to set the size and margins, even when I set the margins to zero and the size to A4, I still receive a printout with a 3 mm whitespace on every side.

For your reference, I have created a repository, which you can find at: https://github.com/dontaskit28/print-pdf-kotlin.
Here is the image, hoe the print looks like:
Kotlin_pdf.jpg

Could you please advise on how to achieve true borderless printing with this service?

Thank you.

HP Recommended

Hi @Tatarao,

 

Thank you for your response, 

 

I'm sending a private message to assist you with the next action.

 

Please check your Private message icon on the upper right corner of your HP Community profile Next, to your profile Name, you should see a little blue envelope, please click on it or simply click on this link.

 

I hope this helps! Keep me posted.

 

Alden4

HP Support 

Raj_05
HP Support Community Moderator
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.