#system("gs -q -o "+ file_map + ".pdf -sDEVICE=pdfwrite -c "+ '"[/CropBox [115 55 500 794] /PAGES pdfmark" -f '+ file_map + ".eps") #system("gs -sDEVICE=bbox -dBATCH -dNOPAUSE -f "+ file_map + ".eps -c quit" ) system("gs -sDEVICE=bbox -dBATCH -dNOPAUSE "+file_map+".eps 2>&1 | grep '%%HiResBoundingBox' | awk '{print $2, $3, $4, $5}'>"+file_map+".bbox") bbox=np.loadtxt(file_map+".bbox",dtype=float) marg_box=5. bbox[0]=bbox[0]-marg_box bbox[1]=bbox[1]-marg_box bbox[2]=bbox[2]+marg_box bbox[3]=bbox[3]+marg_box #bbox[0]=offset vertical superior (empezando desde arriba, apunta hacia abajo) #bbox[1]=offset lateral izquierdo (empezando desde la izqda, apunta hacia la dcha) #bbox[2]=offset vertical inferior (empezando desde arriba, apunta hacia abajo) #bbox[3]=offset lateral derecho (empezando desde la izqda, apunta hacia la dcha) system("gs -q -o "+ file_map + ".pdf -sDEVICE=pdfwrite -c "+ '"[/CropBox '+str(bbox)+' /PAGES pdfmark" -f '+ file_map + ".eps") #system("gs -q -o "+ file_map + ".pdf -sDEVICE=pdfwrite -c "+ '"[/CropBox bbox /PAGES pdfmark" -f '+ file_map + ".eps") #system("inkscape --export-area-drawing --export-pdf="+ file_map + ".pdf \\" + file_map + "_.pdf") remove(file_map+".bbox") remove(file_map+".eps") if(tipo==0 or tipo==1): remove(file_in) #Puedes eliminar si quieres el archivo temporal elif(tipo==2): remove(file_inw) remove(file_inct)