Print Page | Close Window

Merging Pages - No Error - No Result

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1372
Printed Date: 04 Apr 26 at 10:10AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Merging Pages - No Error - No Result
Posted By: neuroscript
Subject: Merging Pages - No Error - No Result
Date Posted: 19 Mar 10 at 8:18AM
I've tried countless approaches. All return successful results (return codes from functions) but yield a document w/o the actual results.

Here's the scenario:

1. Drawing application using MoveTo, LineTo functionality of C/C++.
2. When user is finished drawing, GetCanvasDC is called and used to redraw the same thing the user sees on screen.
3. LoadCanvasFromDC is called to create a new doc from these drawing methods. It is then saved and the resultant PDF doc looks as it should.
4. User continues to draw.
5. Next step is to add the new drawings to the existing (previously saved) doc.

Since GetCanvasDC/LoadCanvasDC functions create a new document, I needed to find a way to merge these docs. I've tried LoadCanvasDC with both image & vector. I've tried CapturePage/DrawCapturedPage. I've tried rendering each page to an image and then creating a new page (and new doc with new page) and adding/selecting these images then drawing. I've, essentially, tried every option I could find.

All function calls return a successful result. The resultant PDF (in each case) does NOT have the result I need. That is, there is no combination of these 2 drawn images (which essentially are vectors). Ultimately, NOTHING shows up for drawing (image or captured page).

The concept of the application: Draw->Save. Close app. Load app. Load saved doc. Add more drawings atop the original. Save. The drawing are merely lines.

NOTE: Pages are set to "letter landscape" before LoadCanvasDC is called. I've also ensured I've selected pages, images, etc. The code has changed so many times, that posting it would be useless. The bottom line is: How in the heck can this be done?

Thanks.



Replies:
Posted By: neuroscript
Date Posted: 19 Mar 10 at 9:27PM
I've tried working further with the "RenderPageToFile" option (using PNG), then creating a new doc and adding and drawing the two images. This works, except that there is no transparency, so the 2nd drawn images covers the first. So, it seems this won't work.

Since the LoadCanvasDC has an option to save as vectors (not as a graphic), I would "think" there would be a way to extract the vectors when opening the document. Unfortunately, I have not found a way to do this. Any thoughts?




Posted By: neuroscript
Date Posted: 19 Mar 10 at 9:46PM
OK. Thanks for all the help everyone ;D

I figured it out, thanks to a C# example for adding/drawing images. As well, I saw an unrelated post mentioning that a page's vertical origin is at the bottom.

So, it appears that my calls to DrawCapturedPage required the "top" input parameter to be the height of the page to be drawn...NOT 0.

However, in order to get the dimensions, I rendered the page to an image file and added it to the document.

Is there a more direct method to get the dimensions of a captured page?


Posted By: Rowan
Date Posted: 23 Mar 10 at 10:49AM
There are a couple of ways to get the dimensions of a page. 

Using the  http://www.quickpdflibrary.com/help/quickpdf/PageWidth.php - PageWidth and http://www.quickpdflibrary.com/help/quickpdf/PageHeight.php - PageHeight functions is probably the easiest method. You can see an example of how the DrawCapturedPage and PageWidth and PageHeight functions can be used in combination in this http://help.quickpdflibrary.com/questions/21/overlay-one-page-onto-another-stitch-pdfs - PDF page overlay sample .

Another way to get the page dimensions would be to use the http://www.quickpdflibrary.com/help/quickpdf/GetPageBox.php - GetPageBox function. Use this function to return the dimensions of the page's crop box (the visual region of the page).

Hope this helps.


Posted By: neuroscript
Date Posted: 23 Mar 10 at 7:17PM
It does help, thanks Rowan.
Although I had gotten it to work, this eliminates an unnecessary step.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk