How to print/save a bundle of .png files as a single .pdf file
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
you are trying to process all files, not just PNG ones. You need
for i in IDC_Enterprise_Panel_20070618/*.png
No, only .png files on this directory which was created with screenshots.
Re-test:-
$ for i in IDC_Enterprise_Panel_20070618/*.png ; do pngtopnm $i | pnmtops -noturn > ${i%.png}.ps ; done
Code:
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
pnmtops: warning, image too large for page, rescaling to 0.364286
pnmtops: writing color PostScript...
I've never used nano. Did you maybe save it in msdos mode. I tested the program out before posting it. Here I'll repost it in case there was a mistake posting it last time:
I unindented the "fi" command this time so that it would stand out. This is a cut-n-paste job after testing it three ways (renaming with an .sh extension; running it indirectly with "sh ~/bin/pngs2pdf sample3 *.JPG".
Yes, if the pictures are any graphic format that ImageMagick recognizes, you can use this script.
PS. The line after the rm command isn't in my original script. It is inserted by this site. This doesn't matter. There is one if command followed by one fi command. Also, don't copy the "cat bin/pngs2pdf" line. It isn't a part of the program. It's how I displayed the program in konsole.
PPS. One way to copy and paste from code on the web, to a file is to also have konsole (or a gnome equivalant) open as well as the webpage. Hightlight and copy the fragment in firefox; then go to the console and enter:
cat >filenameENTER
Then press the [INSERT] key or [CTRL]-V to paste it. Enter [RETURN] if you are on the last line, and then press [CTRL]-d to close the file. This is a lot quicker way to create a new file. You don't need to start nano or kate. (And you don't need to post something like the nano bit twice).
I retested it and it didn't work correctly when I used a larger number of pictures on the input. I guess it's back to the drawing board. I haven't tried to do the same manually yet. I need to check if convert expects the sizes to be similar, or something like that. I was getting only one of the pictures in the pdf. I'll comment out the "rm temp.mng" line and check how the intermediate file is.
Using autocompletion, to run pngs2pdf, I found that there is a png2mng.pl script that is a part of "kdesdk".
---
Update: convert didn't convert a list of 20 *.JPG files to a .mng file.
I've never used nano. Did you maybe save it in msdos mode. I tested the program out before posting it. Here I'll repost it in case there was a mistake posting it last time:
I unindented the "fi" command this time so that it would stand out. This is a cut-n-paste job after testing it three ways (renaming with an .sh extension; running it indirectly with "sh ~/bin/pngs2pdf sample3 *.JPG".
Yes, if the pictures are any graphic format that ImageMagick recognizes, you can use this script.
PS. The line after the rm command isn't in my original script. It is inserted by this site. This doesn't matter. There is one if command followed by one fi command. Also, don't copy the "cat bin/pngs2pdf" line. It isn't a part of the program. It's how I displayed the program in konsole.
PPS. One way to copy and paste from code on the web, to a file is to also have konsole (or a gnome equivalant) open as well as the webpage. Hightlight and copy the fragment in firefox; then go to the console and enter:
cat >filenameENTER
Then press the [INSERT] key or [CTRL]-V to paste it. Enter [RETURN] if you are on the last line, and then press [CTRL]-d to close the file. This is a lot quicker way to create a new file. You don't need to start nano or kate. (And you don't need to post something like the nano bit twice).
Hi schiwal,
This time I started "text-editor" on Gnome desktop. Copied and pasted your script on the file. (The embedded codes of webpage won't be copied). Saved the file as pics2pdf.sh.
Then
$ sudo chmod +x pics2pdf.sh
$ sh pics2pdf.sh book.pdf Test/IDC_Enterprise_Panel_20070618/*.png
Code:
pics2pdf.sh: 18: Syntax error: end of file unexpected (expecting "fi")
Put the EOF at the beginning of the line. I think that your copy has spaces before it while mine has a tab.
The hyphen in "<<-EOF" allows you to indent the here document to make the program easier to read. I think that yours isn't ending at the EOF and so doesn't notice the fi statement.
Put the EOF at the beginning of the line. I think that your copy has spaces before it while mine has a tab.
The hyphen in "<<-EOF" allows you to indent the here document to make the program easier to read. I think that yours isn't ending at the EOF and so doesn't notice the fi statement.
Hi jschiwal,
Finally it works here. Steps performed as follows;
$ sh pics2pdf.sh book.pdf Test/IDC_Enterprise_Panel_20070618/*.png
I watched the process on "File Browser". First a "tmp.mng" file of 2.7M was created. Then the said file was converted to book.pdf, 2.5M. On my slow PC (an old P-III box with 384MB Ram) it took >10 min to complete.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.