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!
Hanlde Multiple PDF Pages to Multiple Pages TIFF |
Post Reply |
Author | |
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
Posted: 23 Jan 20 at 10:58AM |
Hi I am Currently using
DebenuPDFLibraryDLL1011 at my end. I am trying to read the multiple pages pdf file into a multiple tiff or into a byte stream can it possibly done by using RenderPageToString ? Here is my sample code List<Bitmap> listOfImages = new List<Bitmap>(); PDFLibrary PL = new PDFLibrary(strDLLPath); if (PL.LibraryLoaded()) { PL.UnlockKey(PdfTask.DebenuPDFLibraryUnlockKey); PL.LoadFromFile(strFileName, string.Empty); const float renderDPI = 180; int intPageCount = PL.PageCount(); for (int intPageIndex = 1; intPageIndex <= intPageCount; intPageIndex++) { // PDF to bitmap byte[] bytesPageBitmap = PL.RenderPageToString(renderDPI, intPageIndex, 7); MemoryStream msPageBitmap = new MemoryStream(bytesPageBitmap); Bitmap pageBitmap = (Bitmap)Image.FromStream(msPageBitmap); pageBitmap.SetResolution(renderDPI, renderDPI); listOfImages.Add(pageBitmap); } }
|
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Can anyone help me out here?
|
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(1)
|
I am afraid am not familiar with the DLL interface, or with using QuickPDF in ths way. But in general, precisely what problems to you see when you run this code in your debugger? What data actually turns up in the string and does it look like a bitmap? Have you tried RenderAsMultipageTIFFToFile ?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
Hi Rocky,
Here it's the other way round to give you an idea what could be possible: https://www.debenu.com/kb/create-a-multi-page-pdf-from-a-multi-page-tiff-programmatically/ This is the function Tim (TFrost) is talking about. It should feed your needs: https://www.debenu.com/docs/pdf_library_reference/RenderAsMultipageTIFFToFile.php There's a stream version, too. I don't have samples regarding this functionality but the developer guide and the online reference will help as well. BTW: There's no need to ask again after some hours. Here's not too much traffic and not all members are familiar with all issues. So sometimes you have to do the first steps with your problem alone and if you have solve your problem you can post the solution here (in the samples section) to help the other ones ;-) Edited by Ingo - 23 Jan 20 at 10:01PM |
|
Cheers,
Ingo |
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Hi tfrost,
Thanks for the response as I did tried using RenderAsMultipageTIFFToFile and I was able to successfully convert the Multiple Page PDF doc to Multiple Tiff File But there's only one problem to it - when it is converting to the GrayScale it is skipping the PDF header image. Here's my sample Code which is working - //DLL file path string strDLLPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), PdfTask.DebenuPDFLibraryDLL); PDFLibrary PL = new PDFLibrary(strDLLPath); if (PL.LibraryLoaded()) { PL.UnlockKey(PdfTask.DebenuPDFLibraryUnlockKey); var strFileName = @"H:\SampleFile\samplecolor.pdf"; PL.LoadFromFile(strFileName, string.Empty); const float renderDPI = 180; int intPageCount = PL.PageCount(); int xx = PL.RenderAsMultipageTIFFToFile(renderDPI, "1-5", 1, 0, @"D:\aaaaa.tif"); if (xx == 1) { } Here's the PDF Image - Here's is the TIFF Image when converted to grayscale - https://imgbbb.com/image/L3pw8v All the pages are writing under Tiff correctly only thing it is skipping the header part not sure what I am doing wrong this problem only comes when writing into the grayscale mode |
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
Sorry, that website does not let me dowload your PDF, even after creating an account, so there is not much more I can say about what the problem might be. If I had the PDF, I could at least tell you whether it converts correctly for me in QuickPDF, with our PDF to TIFF tools.
|
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Hi tfrost
Here's the PDF which I am using currently Link to Download Edited by rocky1 - 24 Jan 20 at 1:35PM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
perhaps the problem is that the header of the pdf-page was an embedded image? What about rendering the page to any other coloured image type... how it looks like? BTW: Till now each new version comes along with enhancements and fixes regarding rendering. Then i see that you're still using version 10.11 - so a test from Tim with an actual version of the library could be very useful for you... |
|
Cheers,
Ingo |
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Hi Ingo,
Yes the other Colored image type is working fine. It has no issues. I am not sure whether its an embedded image or not. I am just using a sample pdf for my test cases. Thanks
|
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
The whole document renders to gray for me with v17.11, and nothing seems to be missing. If you are using the function I suggested both for colour (option 0) and grayscale (1) and only the former produces the correct output, then it is probably an issue in the old version of QPDF you are using. I always convert to colour BMP first, then use our own dithering options to get the maximum quality B/W image for faxing. We need complete control over the resolution, size and quality. If you need true grayscale output rather than monochrome, I would convert the color to grayscale after creating the image from QPDF. In my TIF the 200dpi output is a bit fuzzy because hardly any of the original text is black. I will try to find a convenient way to get the TIF I have created to you. But all the work we do is the colour to monochrome; rendering the colour output from QuickPDF is the simple part!
|
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Thanks for the Update tfrost,
so as i am using QPDF - DebenuPDFLibraryDLL1011 v 10.11 can you please let me know the process require to update as I am already having a license key for v10.11 1.Do I need to buy the new version of QPDF? 2.Will my existing license key supports the updated version of QPDF? 3. Will an update cost to me? or if there's any link where I can look into it it will be really helpful. Thanks |
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(1)
|
You will need to contact Foxit if you want to upgrade. This is a user forum. You can also perhaps get a trial of the later release to test if the rendering is improved. And please note that I am using Delphi, not the DLL version. So the functions I am using which render directly to bitmaps are much more convenient than those in the DLL, and my processing of the colour bitmaps afterwards to create multi-page monochrome TIF is our own code, not in QuickPDF. But the PDF rendering should be common to both editions
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
ask for a testversion to evaluate:
https://www.debenu.com/products/development/debenu-pdf-library/trial/ where to buy the latest version of the library: https://www.debenu.com/store/buy-quick-pdf-library/ for upgrade prices of the library: https://www.debenu.com/store/buy-quick-pdf-library-upgrade/ |
|
Cheers,
Ingo |
|
rocky1
Beginner Joined: 22 Jan 20 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Thank you for the update.
|
|
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