Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
helix
Posts: 4
Joined: 2015-05-24T02:00:43-07:00
Authentication code: 6789

Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by helix »

Hello,

i have a shippinglabel.pdf in letter format an will transform it to a smaller label for my brother label printer.
I must cut and rotate fields of text, logos an barcodes and insert to a new label with a heigh of 62mm.
i don`t know how to start.
i think i must transform the pdf to png and cut out the blocks and create different .png Files. i am right?

i hope someone can help me out.

many thanks.
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by fmw42 »

You can do that or you can convert the image to raster format, expand the image using -extent and draw a new triangle and text at the orientation desired using the same font and font size to match the raster image. But perhaps the former is easier, but must be done manually. You might be better off doing it in GIMP or Photoshop. But if you want to use IM, then

See
-density at http://www.imagemagick.org/script/comma ... hp#density
-units at http://www.imagemagick.org/script/comma ... .php#units
-crop at http://www.imagemagick.org/Usage/crop/#crop_repage
-extent at http://www.imagemagick.org/Usage/crop/#extent
-rotate at http://www.imagemagick.org/script/comma ... php#rotate
-compose ... -composite at http://www.imagemagick.org/Usage/compose/#compose and http://www.imagemagick.org/Usage/layers/#convert
-gravity at http://www.imagemagick.org/script/comma ... hp#gravity
-geometry at http://www.imagemagick.org/script/comma ... p#geometry


Basically:

1) convert your image from PDF to raster such as PNG

Code: Select all

convert -density XX -units YY image.pdf image.png
2) crop out the triangle and rotate it 180 degrees

3) crop out the text and rotate it as desired

4) exend the image to make the right side white as large as you need

5) composite the cropped and rotated pieces where desired using -gravity and -geometry onto the expanded image and set the desired output density and units right before the output.
helix
Posts: 4
Joined: 2015-05-24T02:00:43-07:00
Authentication code: 6789

Re: Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by helix »

Thank you for your quick reply.

I have to print many Labels ervery day, so a batch processing via IM is required.

so I have only the image in many snippets dismantle ready for pasting into a new file .
but that is where I have my problems , because I do not know Which commands I have to use.

I would like to use the " Send to function" in Windows . when I click on the file 1234letterlabel.pdf , he shall read the file name and create a new file named 1234letterlabel_small.pdf in the new format . this is possible with IM ?

I have no idea how I can say IM how and where it should insert snippets into a new file and that he should name it with the original file name with the extension _small.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by Bonzo »

I would have thought it would be easier all round to get the original software to generate the small label at the same time as the large label.

If that is not an option I assume the shipping details must be stored in a database and use that to generate a label.
I would like to use the " Send to function" in Windows .
If you want to carry on with the Imagemagick method I would make sure the send to works first. This will probably need more work as you will now have an image but you will then need to open it again to print it - all rather long winded. This means you will have to write a batch script or similar to create the image and then send it to the printer.
helix
Posts: 4
Joined: 2015-05-24T02:00:43-07:00
Authentication code: 6789

Re: Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by helix »

My problem is that I do not know how I have the commands to write and in what order. It would be a help if someone can post a code example for me , as I cut the image and how I put together again.should I simply add the snippet back together, or should I create a blank label with Photoshop and then put the snippet on it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cut and Rebuild a shippinglabel.pdf to a smaller labelprinterlabel.pdf

Post by fmw42 »

If the diamond and the text are in different positions and/or different sizes, then it will be very hard to do that automatically. If the diamond and text are always contained in the very same size rectangle and positioned the exact same way for the original image, then you just need to figure out the crop coordinates, crop those pieces, then extend the image and overlay (composite) them in the desired locations. See my links above.

What platform and what version of IM are you using. Scripting is different for Windows than Unix systems.
Post Reply