Print Page | Close Window

DARenderPageToStream

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=1805
Printed Date: 02 Feb 26 at 4:01PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DARenderPageToStream
Posted By: bb46970
Subject: DARenderPageToStream
Date Posted: 13 Apr 11 at 6:58PM
Hi,

I have a problem merging PDFs.  I have tried several different tools.  However, on occasion, one of the PDFs may have a problem with a text object or an image object.  The resulting PDF may display fine with the Foxit Reader, but Adobe Acrobat reports an error and does not display the page.

I tried the following.  The functions all show valid handles or return 1 (for true), but Acrobat reports an error and Foxit displays blank pages.
  for iPage := iInvCount downto 1 do
    begin
      iRecNewPage := QP.DANewPage(iRec);
      iRecFirstPage := QP.DAFindPage(iRec, 1);
      iInvPage := QP.DAFindPage(iInv, iPage);
      iInvCap := QP.DACapturePage(iInv, iInvPage);
      if iResult = 0 then
        ShowMessage('Did not render');}
      iHeight := QP.DAGetPageHeight(iInv, iInvPage);
      iWidth := QP.DAGetPageWidth(iInv, iInvPage);
      iResult := QP.DADrawCapturedPage(iRec, iInvCap, iRecNewPage, 0, 0, iWidth, iHeight);
      if iResult = 0 then
        ShowMessage('Did not draw');
      iResult := QP.DAMovePage(iRec, iRecNewPage, iRecFirstPage, 0);
      if iResult = 0 then
        ShowMessage('Did not move');
    end;
      iResult := QP.DASaveAsFile(iRec, RecordsFileSave);
      if iResult = 0 then
        ShowMessage('Did not save');
   QP.DACloseFile(iInv);
   QP.DACloseFile(iRec);

QP.DARenderPageToFile(iInv, iInvPage, 7, 300, 'F:\Development\Projects\Test\Delphi\D2010\PDFs\FoxItMerge\test.tiff'); works fine. 

Is there a way to call DARenderPageToStream and then go from the stream to a new page?

Thanks,

David



Replies:
Posted By: Wheeley
Date Posted: 13 Apr 11 at 8:07PM
Why not try one of the merge functions instead? MergeFilesFast could be faster than your method above.

Wheeley


Posted By: bb46970
Date Posted: 15 Apr 11 at 6:57PM
Hi,

I did not expect that to work, but it did.  I used to use QuickPDF for merging PDFs, but I had to stop, because some of the resulting PDFs were corrupted or zero byte files.  Our PDFs come from different sources and do not necessarily have proper structures or may have different compression algorithms.  I have been using Acrobat with OLE Automation.  This is the first time that I tried MergeFilesFast.  It worked on my first test.  I even tried Foxit's DLL SDK to merge these two PDFs and got a PDF that Acrobat would not display.  I am going to test it with some known problem PDFs and see how it works.

Thanks,

David


Posted By: Wheeley
Date Posted: 15 Apr 11 at 9:18PM
Be sure to use the latest version because Debenu has added better support for reading corrupt PDFs and more compression formats such as JBIG2.

Wheeley


Posted By: bb46970
Date Posted: 16 Apr 11 at 9:55PM
It failed.
I upgraded from 7.19 to 7.24 and ran a test on another set of PDFs.  The first PDF is two pages, created by XFRX.  The second PDF is 228 pages of images, created by BlackIce PDF print driver.

The resulting PDF displays fine with the Foxit Reader.  It does not care about structure.  It just displays what it finds.  Acrobat displays the pages from PDF 1 fine (pages 1-2).  However, it blows-up the first three pages from PDF 2 (pages 3-5) to over 6000% to display blank pages, and reports an error.  Acrobat displays pages 6 to the end okay.  We have had similar problems with PDF generated with VeryPDF's PDFCamp, instead of BlackIce.  There may be problems with the PDFs generated by XFRX, but it must be a combination of problems from both PDFs, because not all PDFs have these merging problems.  Just looking for a way to merge these PDFs without errors.

XFRX is created by Eqeus.  It is a print listener that compiles into Visual FoxPro apps and prints VFP reports to PDF.  XFRX produces text PDFs.  The BlackIce print driver is just a Windows printer that prints to PDF.  BlackIce is set to produce PDF pages as images.

Thanks,

David



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