logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Thursday, January 18, 2018 11:51:10 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
If I create a PDF from scratch using Pdfium.Net, I see that each new object saves and restores the graphics state with the q and Q operators wrapped around its content. Therefore, if I am working with my own documents, I can treat the Matrix property for each new PdfPageObject I add as an absolute transformation for that object.

However, if I load a PDF that originates from some other source that I do not control, the graphics state (or Current Transformation Matrix) after the existing page objects have been loaded could be anything. Therefore, the matrix I apply to my first new object is concatenated with the CTM, and may appear with unintended transformations applied.

Is there a straightforward way to wrap a q and Q operator around the existing PdfPageObject collection using Pdfium.Net? This would probably have the same effect as clearing the CTM.

Alternately, is it possible to determine the current transformation matrix that results from the existing collection of PdfPageObjects? For example, is there a way to detect or count the q and Q operators that have been issued already, in order to calculate the CTM by concatenating the matrices of those objects that were generated on the current graphics state stack? Then I could calculate the inverse of that matrix and use that as a starting point before adding new objects.

Anton  
#2 Posted : Friday, January 19, 2018 5:17:20 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
Maybe you can get access to page stream and analyze its content?
You may get access to decoded stream data as shown here
https://forum.patagames....DF-resize-pages#post1096
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.