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

TOPIC:

How to Copy Page Content 6 years 11 months ago #12336

  • ashughes
  • ashughes's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 1
Question:
Is there a way to copy PageContent, specifically Text (including any embedded fonts), from one page to another?

Background information:
Our application displays text by drawing to an Android Canvas using drawText(). This uses the Android system fonts, including any fallback fonts, to make sure the text is displayed. There isn't any way to determine which fonts are used by the system to display a particular text.

When we export a note to a PDF that contains text as described above, we have to specify which font to use. As I mentioned above, this is not something that can be queried. If we use Roboto, and the text is Japanese characters, then the PDF will display tofu (font squares) for the text.

A workaround for this we discovered is using the PDF support that is built into Android starting in API 19: developer.android.com/reference/android/...pdf/PdfDocument.html

Using the Android PdfDocument, we can create a PDF with a single page that contains the text displayed the exact same way it is displayed in the app. The Android PdfDocument determines which fonts are used by the text and embeds them into the PDF. It is able to do this because it uses the same Canvas API that's used for drawing to the screen (and therefore it knows which fonts to use at that low level).

Once we have created the PDF that contains the text as described above, we would like to open this PDF using the Radaee SDK and copy this text object (including the embedded fonts) to another PDF.

For clarification, we're dealing with PDF content, not Annotations. There appears to be a way to get an Annotation and move it to another page, but I do not see a way to get a content object and make a copy of it or move it to another page (or another PDF).

If it is not currently possible to get and copy page content, can this be added?

Thanks,
Andrew

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

Last edit: by ashughes.

How to Copy Page Content 6 years 11 months ago #12344

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Dear Andrew,
You can use the below APIs to get each char, get its rectangle (to get position and size), and get its font name.
For embedded fonts, they cannot be copied (license violation motives), importing a whole page with its resources is ok, but copying a part like font no.
So if the font is free or has an equivalent free type, it can be added using Font rendering problem
ObjsGetCharCount
ObjsGetCharFontName
ObjsGetCharIndex
ObjsGetCharRect
ObjsStart
ObjsGetString
www.radaeepdf.com/documentation/javadocs...l#ObjsGetCharCount--

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

How to Copy Page Content 6 years 11 months ago #12369

  • ashughes
  • ashughes's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 37
  • Thank you received: 1
If it's not possible to copy content (including resources like fonts) from one page to another, what about merging two pages together?

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

How to Copy Page Content 6 years 11 months ago #12376

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
This is not supported, you can only use the suggested APIs to copy/merge the page text content.

You can open a support ticket addressed to (RadaeePDF Support) as handler, and ask for this feature.

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

  • Page:
  • 1
Powered by Kunena Forum