Inkscape svg to pdf crops too much - pdf

There is a slight error when exporting an svg file to pdf: the right margin of the plot is cropped too much (see the missing vertical line for completing the box area of the plot - this is how the pdf looks like):
Here is the svg file (the box area is complete - the right margin line exists):
I'm exporting with this command:
inkscape filename.svg --export-area-drawing --export-pdf=filename.pdf
I also did a test and manually exported the file from the GUI but it gave the same result. Is there a way to fix it? Like adding some padding? Can it be done from the command line?

Posting/linking the svg file could help. Tried to download the complete image, transform it as vector and export it as pdf, worked fine.
wich version of Inkscape are you using ? It is up to date ? ( mine, that is working is version 0.48.4 r9939 on Ubuntu ).
A solution I use when facing export problems is create a empty rectangle around my draw, set it to no border and no fill, and then apply "File" > "Document Properties" > "Resize page to content" > "Resize page to drawing or selection" with no object selected. Re-export.
Try to make a "Vacuums Defs" to clean the svg file before export.
Good luck to you!
EDIT : command line equivalent to this manipulation can be achieved by adding "--export-area-drawing --vacuum-defs" as command line parameters.

Related

PDFBox generate so blacked line when I zoom out

When I try to print lines using PDFBox, it creates line so blacked when I zoom out generated pdf file.
I'm creating a dashed pattern using content stream with line methods (moveTo, lineTo). For dash pattern and setting specific size I use methods (lineWidth, setLineDashPattern).
You can see code on my github repo (https://github.com/dmmax/pdfbox-dotted-pattern/blob/master/src/main/java/me/dmmax/pdfbox/dottedpattern/Main.java)
Below picture with opened two files: my result (left side) and example how it should look like (right side). Zoom of both files is 50%.
Or you can check on your computer, just download two files:
1) My result: https://github.com/dmmax/pdfbox-dotted-pattern/blob/master/print.pdf
2) Example: https://github.com/dmmax/pdfbox-dotted-pattern/blob/master/informationyoushouldknow.pdf
Does anyone know how to fix blacked lines when I zoom out result pdf?
Thank a lot to #TilmanHausherr with his big help in this question.
If you have so blacked line(-s) in zoom out of pdf then this happens because pdf render a lot of small objects but in zoom out size have the same (or close to it) size.
For me resolve this problem is generate dot/dash pattern (with needed count of lines) in another pdf and after that I convert pdf to XObject and print on my current pdf.
Yes it takes up more space, but there are no blackouts

illustrator text box resize

Good day good people of Stackoerflow,
I encountered the following problem, I cannot resize textbox in Illustrator or Images.Example for image
example for text
I tried the Free Transform Tool it didn't help. I am using Illustrator CC 21.0.2 64-bits.
for image: -click on the image after look top tool bars your show a tool "transform" please look below image.
click this menu fix height and width and after that make a new template and copy paste to this image and export in .png format with 72 ppi resolution
The text box maybe set to 'automatic' in the Type>Area Type Options... Uncheck the option and it should fix the issue

How can I easily crop a PDF page?

How can I easily crop a PDF page in a given PDF file? I prefer using as little coding as possible, and guess border geometries as little as possible...
There are several options:
Crop by point-and-click using a GUI front-end:
pdf-quench
krop
briss
PDF scissors
Crop by using the command line:
pdfcrop command (provided by texlive-extra-utils), using the following arguments: pdfcrop --margins '-30 -30 -250 -150' --clip input.pdf output.pdf (-left -top -right -bottom format).
PDFCrop
convert -crop command (provided by imagemagick)
Ghostscript
Crop by writing your own script:
Python
LaTeX
For quick, GUI-aided PDF cropping tasks, try pdfarranger (available in Debian repos, formerly known as PDF-Shuffler).
For precise point-and-click cropping, one option is to use LibreOffice Draw.
The instructions below assume you want to crop part of a single-page PDF:
Start with a blank document
Select the Insert > Image... menu
Navigate to the PDF you wish to crop
The contents of the PDF will show up as an image
Right-click on the PDF content in your document and select the "Crop" menu item.
Use the handles to resize the viewable area of the PDF to the section you want to remain after cropping
Click outside of the PDF to disable the crop handles
Click again on the PDF content to position it however you want by:
Dragging it around the page
Using the arrow keys to move it
Use the Draw positioning tools to align or center the PDF content.
When you're happy with the result, save, export it to PDF, or print it.
For multi-page PDFs, You'll have to work page by page by first splitting the PDF into multiple pages using some other tool like PDF Arranger (or simply "Printing to PDF" each page of the PDF you want to crop in your PDF viewer), cropping them one by one with Draw, then recombining them into a single PDF (using PDF Arranger again).
You could try using the pdfCropMargins Python program (https://pypi.org/project/pdfCropMargins/) with the -pg option to select the particular page. The command-line program offers many options, and also has an optional GUI.
You can use Inkscape to losslessly crop PDFs. This uses Inkscape's built-in SVG-PDF conversion.
Open your file in Inkscape: File -> Open -> select your file -> Open
Resize PDF:
Using user-input values: File -> Document properties -> Page -> Custom size
Using auto resize to content: File -> Document properties -> Page -> Custom size -> Resize page to content... -> set desired margin -> Resize page to drawing or selection
Inkscape is a particularly good option as often PDF crop utilities (such as krop, mentioned in other answers) do not change the actual size of the object, instead adjusting how much of the object (e.g. an A4 page) is displayed.
E.g. from krop homepage:
Unfortunately, there is no simple way to eliminate
unnecessary/invisible parts of a PDF file. krop only adjusts which
parts of a PDF are displayed; the original content is still there in
the file and will, for instance, show up when editing the file in
inkscape
Editing directly in Inkscape does exactly what this says is impossible.
The list of tools provided by #sparkler was interesting, but did not help me very much.
Some of the tools provided, actually cropped my pages, but usually they involved some conversion to an image which made pdf files blurry and hard to read.
In the end I used podofocrop of PoDoFo tools which was able to retain all the graphics at full resolution and the text as real text.
It will crop all pages to the minimal size (i.e. without a border).
The command is: podofocrop input.pdf output.pdf
To install on MacOS use brew install podofo

Ps2pdf bug? The pdf output is rotated relative to the ps output

I am having a bizarre problem in converting postscript to pdf using ps2pdf. Here is a minimal code snippet that causes the problem.
/Times findfont 40 scalefont setfont
-1 1 scale
15 15 moveto (R) show
This should show the letter, horizontally reflected. And when I view the postscript, that's what I see. But if I take the code above, save it as a file "bad.ps" and run the following command on it
ps2pdf bad.ps
I get a vertically reflected letter R.
I get the same problem with other fonts. BUT when I just draw lines, etc., the problem goes away. Any ideas?
It sounds like the orientation of the PDF is rotated. By default, PS2PDF detects the orientation based on the dominant text orientation on the page. To override this behavior, use the
-dAutoRotatePages=/None
command line option. This option is described in more detail on the PS2PDF command line reference.

False dots around circles in pdf export of libreoffice draw

When i draw a small circle in LibreOffice draw and export it to pdf i get some extra dots around the circles. Especially in the upper left and lower right outer corner of the circle.
See example PDF here: https://dl.dropbox.com/u/233922/example-dots-circle.pdf
or as a Screenshot here:
You have any idea how i can get rid of this?
It is old bug and has not been fixed yet. I can reproduce it under Linux and Windows. My version: LibreOffice 4.1.0.
Create new file in LO Impress or LO Draw.
Draw ellipse (or rounded rectangle, or smile etc.).
Set line width e.g. 5mm (for better view).
Export as PDF.
I propose two workaround:
Export to MS PowerPoint and export in it :/
Print to PDF (using e.g. cups-pdf).
ad 1) You must have MS PP and you graphics may look bad.
ad 2) I use cups-pdf and PDF look very well, but:
Text is stored as bitmap graphics (small rectangles)! You can not extract text without using OCR.
You must use paper format from list (A4, A0, Letter etc.). If you use unstandardised paper format you must use bigger format and you get white bars on PDF. However you can use pdfcrop and remove white bars.
PDF is always orienter horizontally. If you print as vertically you can rotate pdf using pdf270 command line tool.
In Adobe Reader (version 11 at least) -> Go to "Preferences" => "Page Display" => uncheck "Enhance thin lines"
Libre Office seems to add dots of 0 size and practically no visibility. When "Enhance thin lines" is checked, Adobe Reader will make these dots visible.
Best wishes,
Patrick
Similar to the https://stackoverflow.com/users/1797782/dzwiedziu-nkg 's answer, I need a multi-step process to fix this issue.
Steps:
Open the file in a pdf viewer (Document Viewer for me in Ubuntu.)
Print the pdf to a file (also a pdf) from the viewer. I assume this also uses cups-pdf, as it modifies the image size. (I don't mind, because I use the next step to eliminate all margins anyways.)
Use pdfcrop to remove all the extra space around the actual content's bounding box. If you just give pdfcrop one argument, it doesn't overwrite the old file, so use the same argument twice:
$ pdfcrop monkey.pdf monkey.pdf
Another "workaround" that worked for me:
Go without outline. You can set the line style in Draw to "none" and just work with flat solid objects.
PS: I see these dots also in Draw, not just in the exported pdf.
A simple workaround is to "patch" the dot in Libreoffice Draw using a white object -- say, a square with white area and white outline. Note that you can not see the dot in Draw. So you first generate the pdf with the orginal drawing, see where the dot appears in the pdf, go back to Draw, and a add a white patch where it is required.
Searching for a workaround myself, I've found this awk script called odg2epsfix that will fix the exported EPS to not contain those ghost dots anymore.
I stumbled upon it in this launchpad bug entry.
Fixed in LibreOffice pre-export.
Steps:
Right click on the circle in LibreOffice and select "Line"
On the "Line" page, set "Corner Style" to "-none-"
Save document and Export as PDF.
The dot is gone without removing line enhance. Mine still shows in preview but doesn't print.
The bug is still present in LO 6.0. But if you set "Cap style" to "flat" in the "Line" tab of the "Graphic Styles", the dots disappear from the screen and from the exported pdf.