Page 1 of 1

Edit PDF file without loss of quality

Posted: 2016-10-10T07:24:07-07:00
by vasiliy_b
1.Convert PDF File to JPEG.

Code: Select all

convert t.pdf output.jpg
(and trying change density 300 or 100)
2.Overlay image

Code: Select all

composite -compose atop -geometry +0+0 file1.jpeg file2.jpeg file3.jpeg
(file2.jpeg very easy)
3.Collect the file back to PDF, the file increases in size, but the quality is much worse.

Code: Select all

convert *.jpg -adjoin file3.pdf
Tell me where is my mistake.

Re: Edit PDF file without loss of quality

Posted: 2016-10-10T07:48:23-07:00
by dlemstra
I have moved your topic since this does not look like paid consultancy.

Re: Edit PDF file without loss of quality

Posted: 2016-10-10T09:26:34-07:00
by fmw42
Your pdf file is a vector file and has no size. It is controlled by setting the density before reading the pdf, which defaults to density 72. So the vector file is converted to a raster at low density. Going from vector to raster will definitely increase the file size. To get better quality, you should increase the density before reading the pdf and then if that is too big an image (WxH), then resize down by the same ratio of 72/density.

Code: Select all

convert -density 288 t.pdf -resize 25% output.jpg
Perhaps you should provide your input PDF file so we can test with it. You can upload to some place such as dropbox.com and put the URL here.

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images,

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

Re: Edit PDF file without loss of quality

Posted: 2016-10-11T01:28:40-07:00
by vasiliy_b
As far as I understand the pdf file, not a vector.

https://www.dropbox.com/sh/jq9xxha9olhh ... CtbMa?dl=0
The link you can see there is an example of a pdf file and the image that I'm trying to impose.
Version: ImageMagick 7.0.3-2 Q16 x64 2016-10-02 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
OS: Windows 7 x64
PS:
Sorry by my English is very simple

Re: Edit PDF file without loss of quality

Posted: 2016-10-11T08:49:13-07:00
by fmw42
You may have a raster image imbedded in a PDF vector shell. If that is the case, you have two options.

1) Remover the raster image from the PDF shell. See the section on extracting the image from the pdf (pdf to image) at http://www.imagemagick.org/Usage/formats/#ps

2) Try

Code: Select all

convert -density 288 t.pdf[0] -resize 25output.png
or

Code: Select all

convert -density 288 t.pdf[0] output2.png
Then copy the barcode from the result.

Re: Edit PDF file without loss of quality

Posted: 2018-03-27T02:19:47-07:00
by thisiszivko
Maybe I missed something, does Adobe Acrobat not allow to do that?

Re: Edit PDF file without loss of quality

Posted: 2018-03-27T04:13:46-07:00
by Brandon Wheeler
I had some attempts to work with PDF files, and I must say that it is laborious and long work.

Not long ago I started using the online PDF file editor https://edit-pdf.pdffiller.com/ and now it takes only a couple of minutes to edit the document, you should try this tool and evaluate the benefits of using it as I did.

It worked. Well, the same procedure applies if part of the corresponding editing should be included a data file.