[poppler] pdftocairo - Updated Patches
mpsuzuki at hiroshima-u.ac.jp
mpsuzuki at hiroshima-u.ac.jp
Sat Aug 14 03:47:35 PDT 2010
Hi,
On Fri, 13 Aug 2010 23:06:40 +0100
Albert Astals Cid <aacid at kde.org> wrote:
>A Dissabte, 31 de juliol de 2010, Adrian Johnson va escriure:
>> On 30/07/10 04:51, Albert Astals Cid wrote:
>> > A Dimarts, 20 de juliol de 2010, Stefan Thomas va escriure:
>> >>> I disagree. My original pdftocairo patch outputted PS/PDF to one file.
>> >>> That is the way it is intended to work similar to pdftops. Your patch
>> >>> introduced a bug.
>> >>
>> >> Gotcha.
>> >>
>> >> Ok, I've used multipage as the default behavior where supported and
>> >> added a "-split" option for splitting into individual files.
>> >>
>> >> New patchset attached. This final version should address all feedback
>> >> from reviewers. Thanks again!
>> >
>> > So everyone ok with me commiting this?
>>
>> I've just done some testing with the patches and found a problem with
>> the generated output file name.
>>
>> My original patch would, if no output file name is specified, use the
>> input filename to generate the output name like what pdftops does. eg
>>
>> "pdftocairo -ps foo.pdf" will create foo.ps
>> "pdftocairo -png foo.pdf" will create foo-001.png, foo-002.png, ...
>>
>> the updated patches are doing:
>>
>> "pdftocairo -ps foo.pdf" will create cairoout-001.ps
>> "pdftocairo -png foo.pdf" will create cairoout-001.png,
>> cairoout-002.png, ...
>>
>> which is not very user friendly.
>>
>> Also, when generating multipage output, the "-001" should not be
>> appended to the file name.
>
>Stefan are you fixing this?
His latest patch set in my hand is
http://lists.freedesktop.org/archives/poppler/2010-July/006126.html
http://lists.freedesktop.org/archives/poppler/attachments/20100720/52c8130d/attachment-0001.txt
If newer one is posted, please let me know.
Following modification can drop the page number suffix in
output filename when "split" flag is disabled. Stefan, could
you review?
Regards,
mpsuzuki
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index d12f9ce..551cd1f 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -143,8 +143,13 @@ static void format_output_filename(char *outFile, const char *outRoot,
{
if (!outRoot) outRoot = "cairoout";
- snprintf(outFile, OUT_FILE_SZ, "%.*s-%0*d",
- OUT_FILE_SZ - 32, outRoot, pg_num_len, pg);
+ if (split) {
+ snprintf(outFile, OUT_FILE_SZ, "%.*s-%0*d",
+ OUT_FILE_SZ - 32, outRoot, pg_num_len, pg);
+ } else {
+ snprintf(outFile, OUT_FILE_SZ, "%.*s",
+ OUT_FILE_SZ - 32, outRoot);
+ }
if (png) {
strcat(outFile, ".png");
More information about the poppler
mailing list