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!
lexicographic sorting issue |
Post Reply |
Author | |
puneethcm
Beginner Joined: 08 Feb 15 Location: India Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: 08 Feb 15 at 3:49PM |
hi i have a question regarding quick pdf conversion. In my application we covert two or more pdf files (which each pdf page is alphanumeric) am trying to convert all this pdf files into one pdf file but the order of the pages is sorting in lexicographic order(like 1,10, 11,12,13.....2,20,21,.....and so on).may i know the solution for this issue. the application converts each pdf page to .emf file and from .emf to final pdf file(which is combination of all pdf pages of pdf files) .....
May i know why the the issue is arising and solution for the problem... Thanks in advance.... |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Hello,
This sounds more like a coding problem than a Debenu Quick PDF Libary file. Files in an operating system are sorted on an ASCII sort. If you want page numbers sorted numerically then you will need to load the filenames into a custom sort algorithm that sorts the files numerically. If you post some code as to how you load each file then we may be able to help you. Andrew.
|
|
puneethcm
Beginner Joined: 08 Feb 15 Location: India Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Thanks andrew for the reply...
We use VB for scripting... Set qp = reportobject("QPDF.QuickPDF") Qp.renderdocumenttofile picture quality, 1, inumpage, 3 , docpath + "\" + zero + picturequality.emf Here QP.renderdocumenttofile converts the PDF pages to .emf and .emf to final single PDF file which has sorting issues.... Inumpages is total number of PDF files Docpath is temporary folder where the .emf images are created. Zero is a variable where zeros are appended to solve some issue. The file name of images are pucturequality1, picturequality so on.... can't we access these image file individually?? I tried but dint find the solution... |
|
erico
Senior Member Joined: 24 Sep 14 Location: Minnesota USA Status: Offline Points: 51 |
Post Options
Thanks(0)
|
Format you page numbers with leading zeros, as in
01, 02, 03 . . . 10, 11, . . . 20 Use as many leading zeroes as necessary. (001 . . . 999) (0001 . . . 9999) etc. |
|
Eric O
|
|
puneethcm
Beginner Joined: 08 Feb 15 Location: India Status: Offline Points: 5 |
Post Options
Thanks(0)
|
The thing is it generates .emf file name as picturequality1, picturrqualit2, .....picturequality10.....we can't access the .emf file and modify the name...
|
|
erico
Senior Member Joined: 24 Sep 14 Location: Minnesota USA Status: Offline Points: 51 |
Post Options
Thanks(0)
|
'it' generates emf file names -- what is 'it'? Perhaps you can take the files from 'it' and rename them before feeding them to Debenu.
Or if 'it' is an application under your control, you can modify the behavior to name the files differently |
|
Eric O
|
|
puneethcm
Beginner Joined: 08 Feb 15 Location: India Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Application is not under our control and we can't access these .emf files and rename it..emf file is image of PDF pages...
|
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
Why are you using temporary EMF files at all? If the objective is, as you say, to merge multiple PDF documents into a single PDF, go to the scripts section in the Library Dashboard, then Document Manipulation, then Merge a List of PDFs, and look at the example there. This will add the documents to the merged file in the order that you specify them.
Having said that, it seems that RenderDocumenttofile has a design flaw. It knows in advance how many pages will be output, so it should really provide at least an option to use a variant of %p to add the correct number of leading zeros to the filenames. |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
puneethcm,
Instead of using RenderDocumentToFile you will need to use add your own loop and call RenderPageToFile instead. This will allow you to control the filename for each page and to add leading zeros. ' ------------------------------------------------------------------------------------------------------------------------- Set qp = reportobject("QPDF.QuickPDF") QP.LoadFromFile("input.pdf", ""); lNumPages = QP.PageCount(); for page = 1 tp lNumpages begin ' Here you need to create a unique filename for each page with leading zero's. filename = docpath + "\" + picturequality + String.Format("{0:0000}", page) ' Visual Basic - Google Search for 'VBScript leading zeros' if you need VBScript QP.RenderPageToFile(dpi, page, 3, filename); end; QP.RemoveDocument(QP.SelectedDocument()) ' -------------------------------------------------------------------------------------------------------------------------- Andrew
|
|
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