Referring to a previous question
Inserting a pdf file in latex
I'd like to ask how to insert a PDF page into a latex document by filling exactly one page.
If I include a page with design elements that extent to zero margin off the page edges, the solution provided in the link will result in the following, adding white margins of different sizes to the included page:
how do do this propably?
i did workaround-solve it by
\includepdf[noautoscale = true,scale=1.03 ]{<file>}
but this dos not precisely match the old page edges with the new ones. is there a clean version?
Solutions that did not bring the desired results:
https://tex.stackexchange.com/questions/105589/insert-pdf-file-in-latex-document
Thanks!
To adjust the width and height for your pdf pages. First you should use noautoscale to be able to use width and height.
Remark: don't use fitpaper=true or trim=Left Bottom Right Top because they are for geometry page not to adjust your pdf pages.
\documentclass[]{book}
\usepackage[]{pdfpages}
\begin{document}
\includepdf[pages={1},noautoscale,width=5cm,height=10cm]{your.pdf}
\end{document}
Related
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
I have been trying for days to find a solution for my problem: I want to resize an existing pdf from A4 to a given individual smaller page size. And I need the real page size to be changed, not the crop box or something like that.
The original pdf will always consist of only one page and all content (e.g. texts (some with hyperlinks), images and tables) will fit into the wanted page size. In fact I want to trim the pfd page to a rectangle that exactly fits to the existing content (the content starts at the left upper corner).
As I found no way to change the page size of an existing pdf page, I tried to create a new pdf with the wanted page size and copy all the content of the original pdf to the new pdf. But that doesn't work either (I can create the new pdf page with the wanted size, but I cannot copy the content).
Any solution (iText 5 or 7) is welcome.
I'm using iText with Java to create a PDF file. I'm trying to place a paragraph on left, and float an image on right (e.g. next to each other). Using the following code does insert the image, but it also makes the text fuzzy on the entire page (other pages are fine).
// add image
Image img = Image.getInstance(imgPath);
img.setAlignment(Image.RIGHT | Image.TEXTWRAP);
img.scaleToFit(1000, 72f); // 1" height
//img.setSpacingBefore(0f); // does not have any effect
document.add(img);
// add text
Paragraph par = new Paragraph("some text here", styleBody);
par.setSpacingBefore(20f);
document.add(par);
If I remove the image portion of the code, the text looks clean. This is my first attempt at adding an image next to text. Must be doing something obviously wrong. Any idea what could cause this?
I was able to solve this problem. The code above is perfectly fine. The problem was I was using a PNG image with transparency. When I removed the transparency (by re-exporting the image from Illustrator with transparency turned off), I was able to create PDFs with clear text.
I think the transparency forces the PDF page to be written in CMYK color scheme rather than RGB, which perhaps causes this issue.
Hope this helps someone else. I searched everywhere but couldn't find any leads talking about fuzzy text in iText.
I have a pdf book that is not showing up completely. I have attached a screenshot of acrobat's print preview showing what the issue is. As you can see there is more conentent on the left of the page that is not showing up.
I have tried:
Changing the paper size
Changing the dimensions to "fit"
Opening in Google docs
Opening in mac's preview
Opening in Google Books.
Any ideas of what I can try
As a late answer and when using Linux, one can use the command line tool "pdfjam".
Add margins to pages
Desired result: remove 0.5 cm from top and bottom of page, add 2 cm to right margin. Keep page size (important)
pdfjam --fitpaper true --trim "0cm 0.5cm -2cm 0.5cm" input.pdf -o output.pdf
Negative numbers in the trim-argument means "add", while a positive means "remove".
The four numbers within the trim-arguments relates to the left, bottom, right and top margin
If fitpaper is set to false the trim will move the content around the page and not resize the page.
You can add "--frame true" to see what's going on.
Move content to the left
Desired result: make right margin 1 cm larger and left margin 1 cm smaller
pdfjam --offset "-1cm 0cm" input.pdf -o output.pdf
The command below will move the content of the page 1 cm from right to left.
pdfjam and documentation
Documentation about pdfjam can be found here: http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam
The combination of pdfinfo, pdftk and pdfjam can be used to modify PDFs quickly on a more advanced level.
If I was you, I would check if PDF page boxes are correct. Especially if document looks fine in viewer but offset in print preview.
The issue might be caused by any of the boxes defined so they are outside of MediaBox.
Another approach to try is to impose this document onto other document with some offset. Others recommend Multivalent and Ghostscript for the task.
Without seeing the PDF it is hard to determine the exact reason for what you're seeing, but often the reason is that the CropBox is smaller than the MediaBox. The MediaBox is the size of the physical page and the CropBox is the area of the page that is viewed or printed. If no CropBox is specified then its value is inherited from the MediaBox.
You can programmatically get the page box dimensions and also set them using my companies free PDF SDK. It's an ActiveX for Windows and it is called Debenu Quick PDF Library Lite.
Upload the PDF and share a link if the page box dimensions do not solve the mystery.
Fixed it!
I had to change the page size of the file (Printing to pdf on a larger paper didnt work)
Steps to get it down:
Open Adobe Acrobat Plus
Click on "tools"
Click on "Crop" (which is under the "Page" section)
Double click anywhere on the pdf
Under "Change page size" make it larger then what it is
apply to all!
That's it!
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.