Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Merge page contents 2 years 8 months ago #15592

  • ashughes
  • ashughes's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 1
Is it possible to merge the content of two pages? I'd like to be able to open two PDFs and copy the contents from a page in the first PDF to a page in the second PDF.

To be clear, I'm not talking about importing a page from one PDF to another. I already know how to do that. That could be the first step, then copy the contents of that page to another page in the PDF, then delete the imported page, if that's necessary.

The result should also include any resources such as embedded fonts that are related to the contents that are copied.

Thanks!

Please Log in or Create an account to join the conversation.

Merge page contents 2 years 8 months ago #15595

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
dear user:
we not supply this feature.
because, some page of PDF file erase background on each page, that mean, previous page content will be erased.
and this feature can be instead of: 
1. create bitmap, and then erase background
2. render page 1 from document 1 on this bitmap.
3. render page 2 from document 2 on this bitmap.

Please Log in or Create an account to join the conversation.

Merge page contents 2 years 8 months ago #15596

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
dear user.
now we add a new method to Master Edition.
which can draw a Page from another Document on Page of destination Document.
we will publish after some test.

Classic Edition has no change.

Please Log in or Create an account to join the conversation.

Last edit: by support.

Merge page contents 2 years 8 months ago #15599

  • ashughes
  • ashughes's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 1
Okay, thank you. Here's our use case, in case it's helpful:

We currently have a text tool which uses the current system font (including whatever fallback fonts the system uses based on the characters the user enters). We can use the Android APIs to write text to a PDF, which uses Canvas / Skia to write the text using the appropriate font for each character and embeds the font into the PDF. We'd then like to merge that PDF page with an existing PDF page. The result would be the existing PDF page with the text on top of the page content with the appropriate fonts embedded.

I hope that makes sense. Please let me know if any clarification is needed.

Please Log in or Create an account to join the conversation.

Merge page contents 2 years 8 months ago #15601

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
it sounds, you have no need to merge 2 PDF pages into 1 page.
our API can write texts directly into existing PDF file.

please reference sample codes: com.radaee.reader.PDFTextAct.NewPage();

you can open PDF file by Document.Open();
and then using Page.AddContent(PageContent) to write contents into existing page.
PageContent object works like a canvas.
and all coordinates are in PDF coordinate system.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.

Merge page contents 2 years 8 months ago #15602

  • ashughes
  • ashughes's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 1
I am aware of how to write text to a PDF page via Page.AddContent(PageContent). This is what we currently do (and have done for many years). However, this is insufficient for our use case.

As I mentioned, our text tool uses the current system font and the Canvas / Skia fallback font system. This means that each character could be a different font. One character might be Roboto while another is using Noto Sans CJK or DroidSansFallback, etc. Android does not provide an API to determine which font is used to render each text character glyph.

This is why we need to be able to use the  Android APIs  to write text to a PDF via Canvas / Skia, which will use the same fonts to render each character as the view system does while rendering to the screen. Then we can merge the contents of the PDF page onto an existing PDF page.

Please let me know if you need further clarification.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum