Print Page | Close Window

Problem with RenderPageToStream

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=3800
Printed Date: 22 Nov 24 at 1:54PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with RenderPageToStream
Posted By: aderg
Subject: Problem with RenderPageToStream
Date Posted: 03 Apr 20 at 11:00AM
I use RenderPageToStream in the background thread to create page preview. A separate object TQuickPDF is created in the thread.  But if there are several pictures on the page, sometimes not all pictures are displayed. How can this problem be solved?
Screenshot is here http://yadi.sk/i/vfupmnvn8wp2Kw" rel="nofollow - http://yadi.sk/i/vfupmnvn8wp2Kw



Replies:
Posted By: Ingo
Date Posted: 03 Apr 20 at 11:21AM
Hi,

but both objects points to the same file?
I don't have much experiences regarding issues like this but as far as i know at least in the past QuickPDF wasn't really threadsave?
Perhaps someone other can advice you a bit deeper...

But anyway... Cheers and welcome here for now,
Ingo



-------------
Cheers,
Ingo



Posted By: aderg
Date Posted: 03 Apr 20 at 11:38AM
Yes, both objects point to the same file. Thanks, I'll try to make a copy of the file


Posted By: aderg
Date Posted: 03 Apr 20 at 12:23PM
I tried making a copy of the file using SaveToStream/LoadFromStream - same problem.. ((


Posted By: Ingo
Date Posted: 03 Apr 20 at 4:28PM
...wasn't really threadsave...



-------------
Cheers,
Ingo



Posted By: tfrost
Date Posted: 03 Apr 20 at 5:46PM
I find QPDF to be thread-safe for our purposes (rendering PDFs to bitmap).  It's the optional PDFIUM DLL that is more likely to fail with multiple threads.

If you suspect a threading issue it might be worth running Sysinternals Process Monitor and filtering on some of your image files that fail to show.  It would indicate any failure to open a file and tell you whether the reason was a sharing violation.


Posted By: aderg
Date Posted: 04 Apr 20 at 12:06AM
Originally posted by tfrost tfrost wrote:

If you suspect a threading issue it might be worth running Sysinternals Process Monitor and filtering on some of your image files that fail to show.  It would indicate any failure to open a file and tell you whether the reason was a sharing violation.

The problem is not with different files, but with different pages of the same file. And only when using the background thread, if you do in the main thread, it is ok


Posted By: aderg
Date Posted: 04 Apr 20 at 12:23AM
I used the information from here http://www.debenu.com/kb/is-debenu-pdf-library-thread-safe/" rel="nofollow -   http://www.debenu.com/kb/is-debenu-pdf-library-thread-safe/
"Debenu Quick PDF Library can be used in a multi-threaded environment so long as a separate instance of the library is created by each thread"
 
I developed a test application. In the background stream, previews are created, but some images on the pages are sometimes skipped. Screenshot here http://yadi.sk/i/JdZlZ5-4gd341g" rel="nofollow - http://yadi.sk/i/JdZlZ5-4gd341g

You can look at the source code, maybe you can tell me something
Sources http://drive.google.com/open?id=1RAckSmQwniH74_bIt5N9UKvLJaF_yTbF" rel="nofollow - http://drive.google.com/open?id=1RAckSmQwniH74_bIt5N9UKvLJaF_yTbF
Exe http://drive.google.com/open?id=1OyT2JuPZEk6LCT1hzkXKZAOSKX-u-3_5" rel="nofollow - http://drive.google.com/open?id=1OyT2JuPZEk6LCT1hzkXKZAOSKX-u-3_5
Test PDF http://drive.google.com/open?id=1j8ucL17jilagtqwJbc393x1RD6Gz1reH" rel="nofollow - http://drive.google.com/open?id=1j8ucL17jilagtqwJbc393x1RD6Gz1reH


Posted By: Ingo
Date Posted: 05 Apr 20 at 10:23PM
This won't work:

procedure TfrmMain.btOpenClick(Sender: TObject);
begin
  if OpenDialog1.Execute(Handle) then
  begin
    LoadPDF(OpenDialog1.FileName);
    LoadPDF2(OpenDialog1.FileName);
  end;
end;

Please don't forget that this is a user-forum - not a helping forum from the publishers ;-)



-------------
Cheers,
Ingo



Posted By: aderg
Date Posted: 06 Apr 20 at 7:16AM
I solved the problem using DPLR renderer and RenderPageToDC



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