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.
|