Solved

Setting printer margin while printing a PDF from a browser.

Posted on 2014-02-28
6
1,433 Views
Last Modified: 2014-03-21
Hi,

I have been trying to print a PDF document which is generated dynamically. It's written in PHP. When I try to print the document from different systems, the margins of the page changes. When I crosschecked it, I found that it's because of the printer margin set on the PDF reader is different.

So I would like to know if there is any way it can be set by some programs which doesn't need to make the user to interfere.
0
Comment
Question by:spectrumsofttech
  • 4
  • 2
6 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39894685
Would it be possible for you to give us some more specific information?  From what we have here, the answer is "maybe."  Many printer drivers have individual settings that are not under the control of the PDF document, but we may still be able to help.

Please post a link to the PHP script that produces the document (you can obscure personal data, but do not remove anything that changes the size or shape of the resulting PDF document).

Please tell us what "different systems" are involved and how they affect the rendering.  Information like operating system. device type, printer make and model will be helpful.

Please tell us what machines are used to print the PDF files, and what print settings you expect the client to use.

Please tell us what margins you want on the output and what margins you're getting from each of the different systems.

Thanks, ~Ray
0
 

Author Comment

by:spectrumsofttech
ID: 39901098
Since the link to the PHP script that generate the document is hosted internally, I will not be able to provide the direct access to it. For your reference, I'm attaching a PDF document generated with the same PHP script.

The PDF was generated by using PHP Class TCPDF (http://www.tcpdf.org )

The document we are trying to generate is CMS1500 02/12 form ( http://www.nucc.org/images/stories/PDF/claim_form_manual_v9-0_7-13.pdf ), which is in letter size (8.50x11.00 Inch). Output PDF is set as dual layer and the upper layer would only be printed on the form.

Scaling type of the printing page should be either set to None/Actual Size/Custom Scaling :100%.

Windows XP and Windows 7 are the host Operation Systems used for the print testing process.

Printer models used are :
1. HP Laser Jet 4000
2. HP Laser Jet 4000N
3. Canon Image Runner 3300i


After setting the Scaling type to 'None', I got the desired output on a HP Laser Jet 4000 printer. Print align was changed nearly 1mm to left and top when I changed by printer from HP Laser Jet 4000 to HP Laser Jet 4000N. Finally there was a change nearly 2mm to top on the printer Canon Image Runner 3300i.

PDF readers used are Adobe reader and Foxit reader. Both gives the same printing output on every system.

PHP Code used to generate the data in the PDF as follows
$pdf->text($x_ax,$y_ax,'value');
CMS-1500-33473-Mathew-Manu--93-.pdf
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39901309
Ahh, that makes it clearer.  The short answer is "no" because the client controls the printer and there is no programmatic way to override the client's settings.  Your best bet is to instruct the client, telling what settings to use on different printers.

On the Epson 3880, the default settings cut off the right side of the PDF document.  When I changed the page layout to "Fit to Page" the document was reduced to 97% of its original size and it fit on the page correctly.  So maybe a good starting point is to tell the client to use the Fit to Page setting.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:spectrumsofttech
ID: 39905601
I had cases in which I got print from different system(one with Windows XP and Other with Windows 7) with same printer (HP Laser Jet 4000) looks different in the alignment. Both systems, we used Adobe reader XI to read the doc and send it to the printer from it by giving same setting.

Why this happens so in the same printer?
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39906154
If you got print from two different systems, you got two different documents.  Even if you used the same Adobe Reader and the same printer, there can be differences in the documents.  There is no way from where I sit to discern what these differences might be; it is a research project that can only be done "on the ground" where you have the systems and printers.  You might consider some comparison software to detect differences between the files.  You would also want to apply the same difference logic to all settings in the path from file creation to the rendered image on the paper.  It's a long path, and studying it will take a lot of time.  My best and most practical advice is to tell the client to use the Fit to Page setting at print time.

You might also want to think about the "printable area" of the standard 8.5 x 11 page.  You cannot print the entire page area -- empty borders are required on almost every printer made (Epson has some fine-art printers that are exceptions, but those are edge cases and not part of your current configuration).  So if your document layout uses the entire 8.5 x 11, it's too big for use as-is and needs to be reduced in size.  That may be why the Fit to Page setting works and the alternatives give uneven formatting.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39945374
Please review the grading guidelines and explain why you gave a marked-down grade.  
http://support.experts-exchange.com/customer/portal/articles/481419

Thanks, ~Ray
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now