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!
Library doesn't open large files and damage them. |
Post Reply |
Author | ||
Harier2008
Beginner Joined: 19 Jun 15 Status: Offline Points: 7 |
Post Options
Thanks(0)
Posted: 11 Aug 15 at 1:33AM |
|
Hello
In my application i need to merge many jpeg files into a one PDF file. After merging i need to embed one PDF to this file. My application convert all jpeg files in folder to PDFs and then merge PDFs in one file. Sometimes after merging i've got big files (about 260 - 320 MB) and library don't open this files after merging (the function LoadFromFile() returns 0). After restarting application i choose this file separately and library works fine with it (embed is ok, but only one time. The second time also will be error.). Also, sometimes library damages my files when i choose files about 320-350 mb and try to embed: I use LoadFromFile() to open original file and AddEmbeddedFile() to embed file. After embedding i use function .SaveToFile() to save changes, but after this function i've got the blank file (with one blank page) with embedded file. Link to some problem files: https://cloud.mail.ru/public/7BXR/whxWogJwv Link to my test project for this issue: https://cloud.mail.ru/public/4sZj/dzwzr1j7P Version of OS: Windows 7 x64, but project compiled in x32 Version Quick PDF: 11.14 What could be the reason for this error? This is a bug of library? Regards, Dmitry.
|
||
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
|
Hi Dimitry,
seems to be more a coding problem than a lib problem? You should post the relevant code snippets (from try up to finally/end) - so someone here can a have a look on it. Cheers and welcome here, Ingo |
||
Cheers,
Ingo |
||
Harier2008
Beginner Joined: 19 Jun 15 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
|
Hello, Ingo.
I posted my test project in VS 2012 (C#): https://cloud.mail.ru/public/4sZj/dzwzr1j7P Also i can post code snippets: This is a code for convert jpeg files to PDF and merge them into a one PDF file:
And also this is a code for embed file:
Edited by Harier2008 - 11 Aug 15 at 7:49AM |
||
Michael_67
Beginner Joined: 07 Aug 15 Location: DE Status: Offline Points: 10 |
Post Options
Thanks(0)
|
|
Harier2008,
You do not need to create and save each jpg file to separate PDF file. It works better with: qp.SelectImage(imgId); ...... qp.DrawImage(0, imgRealHeight, imgRealWidth, imgRealHeight);
qp.NewPage(); ...... (You do not need qp.NewPage(); for the first image)
Edited by Michael_67 - 11 Aug 15 at 9:34PM |
||
Harier2008
Beginner Joined: 19 Jun 15 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
|
Thank you.
It's a good approach! It works very fast. But i still have other problem: 1. I open PDF file (my sample file 324 mb) by LoadFromFile 2. I embed another PDF file to opened file (AddEmbeddedFile and AddFileAttachment). 3. I save it and close (SaveToFile and RemoveDocument) and all works fine. 4. Next i open same file or another big file (more then 300 mb) and try to Embed File to it. Library doesn't open it. Function LoadFromFile return 0. Link to my sample file: https://cloud.mail.ru/public/4nqv/tqNFM4tGf
|
||
Michael_67
Beginner Joined: 07 Aug 15 Location: DE Status: Offline Points: 10 |
Post Options
Thanks(0)
|
|
You files are very big.
It may be that the memory is cleaned too slow. I would unload QuickPDF Library after each document e.G. with Release Library () and force garbage collection with GC.Collect(); GC.WaitForPendingFinalizers(); Best Regards Михаил aka Michael :) |
||
Harier2008
Beginner Joined: 19 Jun 15 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
|
Hello Michael. Thank you for your answer.
324 mb are very big for this library? It's strange for me... I have 8 GB RAM and also SSD Disk. Why 324 mb are too large for shared library? Think this is a question to developers of this library... Michael, I try this: System.Runtime.InteropServices.Marshal.FinalReleaseComObject(qp); qp = null; GC.Collect(); GC.WaitForPendingFinalizers(); And some times it's work, but some times it doesn't work... Most it didn't work... Also if library have some restrictions to file size why developers can't describe them? Дмитрий aka Dmitry :)
|
||
Michael_67
Beginner Joined: 07 Aug 15 Location: DE Status: Offline Points: 10 |
Post Options
Thanks(0)
|
|
I use the DLL variant of of Quick PDF, not a COM. Have you ever considered what is the Error Code (LastErrorCode), if LoadFromFile returns 0? If the memory is not released, two Files can be to big for the 32-bit application. How much memory is used from your application after saving and removing of document? |
||
Harier2008
Beginner Joined: 19 Jun 15 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
|
Last error code is 401: can't open input file. That's all information :) Now i use DLL version in my project. After any LoadFromFile i use ReleaseLibrary(). Also i add x64 version of library. With x64 all works fine. Files above 350 mb opened successfuly, embedding also successfully (i try three times). I think the reason of all my problems was a memory leaks when i use LoadFromFile in x32 version. But i still think that it's a bug of library (i use it from 2011). I don't think that 325 mb or above it's a big file. Also i found why i've got the blank file after embedding. It happens when LoadFromFile failed. I didn't check this fail and save the blank file with embedded file. Now i check the result of LoadFromLibrary before start to embed file. I dont test x64 version to open big files (above 350 mb). Maybe somewhen i found the way to refuse of embedding and LoadFromFile function. Edited by Harier2008 - 18 Aug 15 at 3:26PM |
||
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