Adding crop marks to existing PDF files - linux

I'm kind of new to all the PDF crop/bleed/trim technicalities... but what I have is business cards in PDF format of about 9 x 5 cm. I just want to add the bleed and crop marks, or if not bleed margins then at least just the crop marks, at specified mm from the edges.
Is there anyway I can do this programmatically in linux? Like maybe by using pdftk or ghostscript or imagemagick or some php library? By crop marks I mean the little lines at each corner of the document. Is it possible to maybe just draw lines on the PDF using imagemagick, if there's no direct function available to do this? Please keep in mind I want to add the crop marks to existing cards, so I'm not making cards from scratch. I'm not sure but this might be called "imposition".
Can it be done easily via a desktop application?

try with latex
create file foobar-crop.tex
\documentclass{article}
\usepackage{pdfpages}
\usepackage[paperwidth=9cm,paperheight=5cm]{geometry}
\usepackage[cam,a4,center,pdftex]{crop}
\begin{document}
\includepdf[pages=-]{foobar.pdf}
\end{document}
compiling with
$ pdflatex foobar-crop.tex
will get you foobar-crop.pdf.
from: http://www.thbimage.com/pdf/adding_crop_marks_to_pdf_pan_2008_10_08_21_47_33_lutrina_.html

Related

How to remove the background from this SVG

I am new to handling graphics and would appreciate some help.
I purchased this particular EPS and trying to edit it.
I am using Vectr for handling EPS/SVG, however, Vectr was not able to open this EPS (bought from iStock).
Tried Gravit and it failed too. Then I converted the EPS to SVG, using an online converter.
This is the graphic I am dealing with:
I just want to remove the checkered background. When I opened this SVG in Gravit, the background shows as a path. There are a large number of paths in this graphic.
Could someone advice on how to remove this checkered background using a SVG editor like Gravit.
Thank you.
You need to use one of these graphic editors: Corel Draw or Adobe Illustrator. You can send the file to me, I will send it to you without a background. kuznetsovasasha86#gmail.com

How to read a map into octave

This is a follow up to my post three weeks ago here How do I use m_map in octave, without really being a nuissance to kind and busy people. My problem is simply how does one overlay a basemap on an octave contour plot. After interpolating my irregularly spaced data (works for both contour lines and filled contours) I plot with the code:
contour(xi, yi, obsi, cstart:cstep:cend)
colorbar;
xlabel('Longitude'),ylabel('Latitude')
title('Mean Rain Onset')
saveas(gcf,'rainzam.pdf')
And I get
I have downloaded several map formats: ne_50m_admin_0_countries.zip, the apparently obsolete m_map (with associated tbase.Z, gshhg-bin-2.3.2.zip), soa.7z, world-bounds.7z, gshhg-gmt-2.3.2.tar.gz, dcw-gmt-1.1.1.tar.gz.
My question is has anyone used any of these maps in octave or gnuplot, and how to? I would appreciate any assistance.
Basically you have to load those maps in octave, they represent borders or coastlines with two variables (x,y) which you can then add to your plot with
hold on
plot(x,y)
That's the easy part, the hard part is to load the maps. All of them have different formats, which means it is a completely different story how to load them. For instance, the ne_50m_admin_0_countries.zip has a dbf format. Either you convert it first to ascii text and load it easily with the load function of octave or you need the OI package (http://wiki.octave.org/IO_package), which in turn demands java (http://wiki.octave.org/Java_package). I don't think this is the easy way for a newbie, so I suggest to convert the maps individually to text: google for "convert dbf to csv", "convert dbf to text", "convert dbf to ascii", etc... Perhaps some of those maps can be even loaded with excel and then saved as text (csv), the important issue is to convert them to text!
If you want to draw physical coastlines, you may download them from this link
https://www.naturalearthdata.com/downloads/
Then, after the drawing of a contour map of your own datas, you may add the coastlines using the following commands:
pkg load mapping
hold on
h = shapedraw ('FileName.shp','r','linewidth',1)

How can I convert several .ai files to various sized .png files automatically?

I am making a deck of cards in Adobe Illustrator. Each card is saved as it's own .ai file so I can change it later if I want to. When using these images in an iOS app, I must convert everything to .png files. Then I must re-size those .png files to have retina and non retina versions. I'm hoping there is a way that will allow me to automatically take a folder of all my .ai files and give .pngs of 200px x 400px and 100 x 200px. Also I'd like the larger ones to automatically be named #2xNameOfOrginalFile.png and the others to be named nameOfOrginalFile.png. I see stuff about batch automated scripting that does stuff like that. I'm curious how simple that is to implement. Is what I'm suggesting possible? Is this an easy process?
Seems pretty easy to do. Someone has posted a script that will do what you want: http://forums.adobe.com/message/4915819
You'll have to change these lines,
pngExportOpts.horizontalScale = 250.0;
pngExportOpts.verticalScale = 250.0;
to calculated values. The scale is a percentage (see: the docs). You can use sourceDoc.width and sourceDoc.height to get the width and height of the original .ai file (in pixels? docs don't say).
You'll also want to modify the getNewName function.

Detect an object in image using IMAGEMAGICK

I have an image with Gray Background and 'CUP' in center of it... I want to detect the boundaries of the cup in this image.. After detecting CUP I want to extract the CUP from the image using IMAGEMAGICK.. Note I have many images with different objects (like CUP) in the center and with different background color .. So I am looking for a solution which is applicable to all of them..
Plz comment..
Maybe you could use edge-detection algorithms to isolate the shape of your main object: http://en.wikipedia.org/wiki/Edge_detection
You could also look into the code for the EdgeImage effect in ImageMagick, to see how they do it...

Create Editable plots from R

I'm creating a series of plots in R (I'm using ggplot2, but that's not essential) and I want to be able to save my output so I can then edit it for furthur use, For instance, I might want to move legends about, or adjust colours etc. I have seen that ggplot2 has a save command but that seems to produce pdf's or bitmaps, neither of which are particularly editable
How do other people do this ? Any good ideas ?
Here's some sample code to produce a sample plot;
library(ggplot2)
dataframe<-data.frame(fac=factor(c(1:4)),data1=rnorm(400,100,sd=15))
dataframe$data2<-dataframe$data1*c(0.25,0.5,0.75,1)
dataframe
testplot<-qplot(x=fac, y=data2,data=dataframe, colour=fac, geom=c("boxplot", "jitter"))
testplot
Thanks
Paul.
Other editable formats:
Take a look at help(devices) for other formats which are available: these include svg, pictex and xfig, all of which are editable to greater or lesser extents.
Note that PDFs can be edited, for instance using the Omnigraffle tool available for Apple's OSX.
Other ways to record plot data:
In addition, you can record R's commands to the graphics subsystem for repeating it later - take a look at dev.copy:
Most devices (including all screen devices) have a display list
which records all of the graphics operations that occur in the
device. 'dev.copy' copies graphics contents by copying the display
list from one device to another device. Also, automatic redrawing
of graphics contents following the resizing of a device depends on
the contents of the display list.
Using Rscript to create a repeatable, editable plot:
I typically take a third strategy, which is to copy my R session into an Rscript file, which I can run repeatedly and tweak the plotting commands until it does what I want:
#!/usr/bin/Rscript
x = 1:10
pdf("myplot.pdf", height=0, width=0, paper="a4")
plot(x)
dev.off();
With ggplot and lattice, you can use save to save the plot object to disk and then load it later and modify it. For example:
save(testplot, file = "test-plot.rdata")
# Time passes and you start a new R session
load("test-plot.rdata")
testplot + opts(legend.position = "none")
testplot + geom_point()
Thanks for the answers, I've played around with this, and after some help from my friend Google I found the Cairo package, which allows creation of svg files, I can then edit these in Inkscape.
library(Cairo)
Cairo(600,600,file="testplot.svg",type="svg",bg="transparent",pointsize=8, units="px",dpi=400)
testplot
dev.off()
Cairo(1200,1200,file="testplot12200.png",type="png",bg="transparent",pointsize=12, units="px",dpi=200)
testplot
dev.off()
Now I just have to play around with the various settings to get my plot as good as it can be before writing the file.
right click the mouse on the output plot
Copy as metafile
then save plot into a word document (right click to edit picture to covert to the plot to Microsoft Office drawing Object)

Resources