I did something like
Active6 months ago
But the 1st page is much larger than the subsequent pages. This happens even though the image dimensions are similar. These images are scanned & cropped thus may have slight differences in dimensions
I thought
-page A4 should fix the size of the pages?
Convert A1 1:100 to A3. Can I take it that the scale on the A3 IS 1:50? Thanks Comment. Scale conversions A1 is twice the size of A3: so converting 1:100@A1 would be 1:200@A3 and that means a 50% reduction in the size of the original. I need to print drawings that have been scaled 1/100 @ A1 but am printing off at A4 how do I. How to convert an A4 size PDF to an A3 PDF booklet? Ask Question -2. How to convert an existing A4 PDF document to an A3 booklet?
Gilles
572k138138 gold badges11811181 silver badges16921692 bronze badges
Jiew MengJiew Meng
68355 gold badges1414 silver badges2727 bronze badges
8 Answers
Last time I used
convert for such a task I explicitly specified the size of the destination via resizing:
The
convert command doesn't always use DPI as default density/page format unit, thus we explicitly specify DPI with the -units option (otherwise you may get different results with different versions/input format combinations). The new size (specified via -resize ) is the dimension of a DIN A4 page in pixels. The resize argument specifies the maximal page size. What resolution and quality to pick exactly depends on the use case - I selected 150 DPI and average quality to save some space while it doesn't look too bad when printed on paper.
Note that
convert by default does not change the aspect ratio with the resize operation:
Resize will fit the image into the requested size. It does NOT fill, the requested box size.
(ImageMagick manual)
Depending on the ImageMagick version and the involved input formats it might be ok to omit the
-repage option. But sometimes it is required and without that option the PDF header might contain too small dimensions. In any case, the -repage shouldn't hurt.
The computations use integer arithmetic since
bash only supports that. With zsh the expressions can be simplified - i.e. replaced with $((i*8.27))x$((i*11.69)) .
Lineart Images
If the PNG files are bi-level (black & white a.k.a lineart) images then the
img2pdf tool yields superior results over ImageMagick convert . That means img2pdf is faster and yields smaller PDFs.
Example:
or:
maxschlepzigmaxschlepzig
36.2k3535 gold badges150150 silver badges221221 bronze badges
What you really want to use is:
-extent actually extends the image to be 1240x1753, while -resize keeps the image's ratio, fitting it into either 1240x.. or ..x1753 .
The
-gravity parameter is optional but can be used to center the image when extending. Download theme effects s60v3.
caugnercaugner
Addition to caugner's answer:
having installed IM v6.6.9-7 i found out the
-gravity parameter needs to be placed in between -resize and -extent to have an effect.
additionally (altough not part of the o.p. question) i found setting a different background-color appealing which would result in the total command of
another useful variation i often use when i don't want to re-scale an image that already comes in the correct aspect-ratio but keep its individual resolution is
where the target density is dynamically determined by calculating the width divided by 8.27 (which is the width in inch of an A4 page). the
-repage a4 parameter can be omitted most of the time but i've had a few cases where the resulting .pdf would have a different format sligtly off the A4 dimensions of 210x297mm (8.27x11.6')
Community♦
antiplexantiplex
I found Mikher's code very useful, however it lays out the PDF entirely as either Portrait or Landscape, so I have modified it to check the layout of each input file and match it in the output.
I didn't include Yotam's edit as it works without it on my Ubuntu 15.04 box.
![]()
user173283user173283
I find the following script convenient which combines the answers listed here as well as some problems I had with the floating point calculation:
The script is called (saved as a file images2pdf)
/edit: Added '-l' flag according to comment by tanius for better precision.
rindPHIrindPHI
I was struggling with that stuff, too. Based on the above info, I wrote a script which adds alphabetically sorted image files into a single PDF.
Some variables are settable inside the script. https://powerfulsx.weebly.com/fight-night-champion-keygen-crack-free.html. It depends on ImageMagick and pdftk.
NB: If the input image has a higher resolution (dpi) than the wanted resolution of output.pdf, the image is resampled to the lower resolution. Otherwise, the image is not resampled and it is only extended to fit the page canvas.
MikherMikher
I highly recommend the Python CLI program
img2pdf for lossless conversion:
Example usage:
Pdf A4 To A3
Adam EricksonAdam Erickson
I just used something similar to maxschlepzigs answer under Ubuntu 16.04 / ImageMagick
This also centers the result
Martin Thoma
Convert Pdf To A4 SizeMartin Thoma
1,23233 gold badges2121 silver badges4242 bronze badges
Not the answer you're looking for? Browse other questions tagged pdfconversionimagemagick or ask your own question.
Active3 years, 8 months ago
I'm testing iTextSharp to generate ZUGFeRD-Files. My first step was to generate a ZUGFeRD conform file from an existing PDF/A-3 file. This was successfull by using PDFACopy and creating the necessary PDFFileSpecification.
The next step would be to generate a PDF/A-3 file from an existing PDF or PDF/A-1 file and this is the hard part.
First, when I'm trying to use PDFACopy in combination with a regular PDF (not PDF/A) im getting an error that PDFACopy can only be used with PDF/A-conform files. My first question is, how to get an PDF/A-3-conform file from a PDF with iTextSharp?
To reduce the gap, I decided to convert the PDF into PDF/A-1 file with ghostscript (cf. How to use ghostscript to convert PDF to PDF/A or PDF/X?).This was succesfull and I tried again. Then the error 'Different PDF/A version.' was thrown. It seems that I can't copy from existing PDF/A-1 into a new PDF/A-3. How can I create this PDF/A-3 from an existing PDF(/A-1)? Is that even possible?
Here is my code:
One more question: addDocument works, but when I'm using copy.addPage(copy.getImportedPage(src_reader, i)), an error 'the document has no pages' will be thrown. WHY?
Community♦
AndyAndy
1 Answer
1. Can you convert a regular PDF to a PDF/A document?
The answer is: it depends.
PDF/A is a subset of PDF and involves some obligations (e.g. all fonts must be embedded) and restrictions (e.g. no Javascript is allowed). iText can't 'automatically' convert a regular PDF to a PDF/A for a number of reasons. For instance: if a font is not embedded, iText doesn't know which font to use to replace the unembedded font, nor where to find the necessary font program. Usually this requires human interaction because replacing one font by an arbitrary other font usually results in very ugly PDFs.
The answer is: it depends because some people are using iText to convert PDF to PDF/A, but this involves a lot of programming and human decisions. I see that you succeed when using GhostScript. In that case, GhostScript is making some decisions in your place. This can lead to acceptable results. In some cases, the result will not be acceptable (e.g. very odd-looking PDFs if the fonts don't match).
2. Can you convert a PDF/A-1 file to a PDF/A-3 file?
The PDF/A standard is written in such a way that old versions of the PDF/A specification are never outdated. Newer versions only add newer functionality. For instance: PDF/A-1 was based on the PDF 1.4 specification. Optional Content functionality (OCG) was introduced in PDF 1.5. The introduction of OCG is one of the differences between PDF/A-2 and PDF/A-1.
This means that every file that conforms to PDF/A-1 automatically conforms to PDF/A-2. However, a PDF/A-2 file could contain functionality that isn't supported in PDF/A-1.
Convert To A4 Size
3. What is the difference between PDF/A-2 and PDF/A-3?
PDF/A-2 and PDF/A-3 are identical, except for one difference: a PDF/A-3 file can have attachments that aren't PDF/A files. For instance: a PDF/A-3 file can have a Word file as attachment, an XLS file, a plain text file,.. You mention ZUGFeRD: in that case, the PDF/A-3 file has at least an XML file as attachment.
Summarized:
This is a broad answer to a broad question (your question goes in many different directions, so it's hard to give you a specific answer). Why don't you use the already built-in ZUGFeRD support to create the invoices? Read ZUGFeRD, the future of invoicing for more info.
Bruno LowagieBruno Lowagie
Convert Pdf A3 To A4 Converter Download
64.6k1010 gold badges8282 silver badges121121 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged c#pdfitextsharpitextpdfa or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |