Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
CapturePage and Existing Comments/Annotations |
Post Reply ![]() |
Author | |
NBachus ![]() Beginner ![]() Joined: 11 Jan 12 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() Posted: 31 Mar 14 at 9:17PM |
When using CapturePage() and DrawCapturedPage() (we're transforming the image to add margins), the existing Comments/Annotations entered in on Adobe Reader are not transferred over to the new "page". I've tried to use CombineContentStreams() to combine all of the content into one stream, but this does not help the issue. Does anyone have any ideas on how to solve this?
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
NBachus,
Annotations are not part of the normal content stream which the CapturePage functions uses. Either are formfields as they are also based on annotations. Annotations are a special type of object that is draw after the rest of the page is drawn. They are not designed to be scaled easily. You can adjust their bounding box but that is the easy bit. You would need to adjust for line thickness and font height also. There is going to be no elegant or easy solution to this. Another option to scaling the page may be to create a new content stream at the start of the file and another at the end to simulate the CapturePage/DrawCapturePage. See the code below. This will keep all of the annots but you will need to move each one manually into position. // Pseudo code QP.LoadFromFile("myfile.pdf", ""); // add a loop here for multipage documents to process each page. int idx = QP.NewContentStream(); string s = "q 0.7 0 0 0.7 72 96 cm "; // space at the end, set transformation matrix QP.SetContentStreamFromString(s); QP.MoveContentStream(idx, 1); // move the content stream to the front of the list. idx = QP.NewContentStream(); string s = "Q "; // space at the end, restore State command QP.SetContentStreamFromString(s); QP.SaveToFile ..... ------------------------------------------------------------------------------------------- // C# version QP.LoadFromFile("myfile.pdf", ""); Byte[] b; ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); int idx = QP.NewContentStream(); // This does all of the scaling. // A transformation matrix - 0.7 = xscale, 2nd 0.7 = yscale, 72 = horz offset, y = vert offset // The scale is for the overall size and the offsets move the page from the bottom corner // and position it where required. string s = "q 0.7 0 0 0.7 72 96 cm "; // space at the end, set transformation matrix b = encoding.GetBytes(s); QP.SetContentStreamFromString(b); QP.MoveContentStream(idx, 1); // move the content stream to the front of the list. idx = QP.NewContentStream(); s = "Q "; // space at the end, restore State command b = encoding.GetBytes(s); QP.SetContentStreamFromString(b); QP.SaveToFile("out.pdf"); Andrew. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() 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 |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store