Archive for the ‘Adobe Acrobat’ category

Adobe Acrobat (PDF) files not displaying correctly on iPad?

October 30th, 2012

I have been working on an adobe acrobat export routine on the web that uses ComponentOne’s Active Reports tool to generate the files and I ran into a bit of a snag when trying to display the files on the iPad. I have posted the code below:

HttpResponseMessage message = null;
var pdfExport = new PdfExport();
var m_stream = new System.IO.MemoryStream();

var rpt = new YourActiveReport();

pdfExport.Export(rpt.Document, m_stream);
m_stream.Position = 0;
message = Request.CreateResponse(HttpStatusCode.OK);
message.Content = new StreamContent(m_stream);

message.Content.Headers.Add("Content-Disposition", "attachment; filename=yourreportname.pdf");
//this is the magic line
message.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return message;

I put a comment on the line that looks like this:
message.Content.Headers.ContentType = new MediaTypeHeaderValue(“application/pdf”);
I didn’t have that line in before and it will work just fine on standard machines like your desktop in your browser but since the ipad either doesn’t allow plugins inside safari or doesn’t know how to handle attachments the pdf was coming back as garbage, basically displaying the raw postscript in the browser, that wasn’t cool. All you have to do is add that line in and all is well, I hope this helps someone.

Adobe disappoints me a bit..

July 6th, 2012

I have been rolling along with my little PDF fillable form and its working great, I got it working on the acrobat reader on Windows and it even works inside Internet Explorer but I noticing it doesn’t work a whole lot of other places, particularly in the mobile world, which is where I forsee my users really want this functionality to end up.

When I open the PDF in safari or chrome, it will let me fill out the form but the submit button does nothing, which surprised me. It turns out each one of those browsers have their own way of handling the pdf form submissions. Here is my findings so far:

IE – Works
Chrome – No Worky
Firefox – Works
Safari – Could not even get it to load, not sure what is going on there

Then I started testing it over on my Kindle and IPhone and iPad, it pulls up on each one of those but again the submit button does nothing, this is very frustrating. Then I found this link and learned that Adobe doesn’t support it yet, so I am waiting on an update.

Adobe Sucks

My solution to filling Adobe Acrobat forms using shared hosting

July 4th, 2012

In my earlier post I discussed how you can fill in pdf forms via FDF files and send that over to a third party tool like Pdftk. That is all fine and good if you are the admin of your server or you are paying for a private server, but if you are like me and have shared hosting, which I am finding most out there do, you have very limited options, but you do have some options and I am going to show you a little example of what I have done to get it accomplished.

I have attached my snippet of code that will process the HTML form data being sent to your php script as described in my article before.


//use this if you want to see the posted data
echo'<pre>POST '; print_r($_POST);echo '</pre>';

// initiate FPDI
$pdf = new FPDI();
// add a page
// set the sourcefile
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 0,0 with a width of 200 mm
$pdf->useTemplate($tplIdx, 0 ,0, 200);

//setting font size and color

//check to see if data is being posted and continue
if(isset($_POST) && is_array($_POST) && count($_POST)){
	//fill in First Name 
    	$pdf->SetXY(4, 26);
    	$pdf->Write(0, $_POST['FirstName']);

    echo 'You did not submit a form.';

//send the generated pdf to the screen
$pdf->Output('newpdf.pdf', 'D');


Notice that a couple of php files are being referenced at the top, you will need to download the FPDF library found here: FPDF Library and the FPDI library found here: FPDI You will probably need to download both files there to get the correct files. FPDF is only needed because FPDI depends on it.

There is one giant piece of suck to this solution tho, and I can’t find the solution I really want either. The big suck with this is that you are basically positioning the data on top of the pdf via X,Y coordinates, so if you notice around the FirstName spot you see where I am putting it (4,26), so that is 4 over and 26 down on the form. Until I can find a better solution, this is all I got. I would love to find a php library out there that can bind the POST data to the form fields but it doesn’t seem to exist in pure PHP.

Making Adobe Acrobat Forms shine

June 25th, 2012

You may or may not know about Abobe Acrobat fillable forms, so this will either be a eye opening post or just a re-hash of something you already knew about. Recently I was asked if I could create a fillable acrobat form and then have that form emailed to somebody that you designate. At first I thought that *should* be possible but I wasn’t sure exactly how it could be accomplished, I know that one can create an acrobat form that the end user can fill out, that part is doable with acrobat forms but I wasn’t sure about the second part.

It turns out that acrobat forms have the ability to have a button placed on them with available actions that can be performed on them, including posting to a website that you hard-code into those actions. It has the ability to send the entire PDF to a recipient but the problem with that solution is that there are so many out there that use Hotmail or Gmail or any number of web-based email clients that abobe just gives you ability to save the filled out form to your system and then attach it later, so that wasn’t really an option for me.

One solution is to have the form button submit the FDF data to a php script on the server that knows how to interpret the FDF data and then parse that data and populate the same pdf file on the server. Here is a link with the basic run-down of what you need to do to make this happen: Acrobat Fillable Forms This approach is quite feasible if you have full access to your server and can create builds on it. In my situation as in most I am using a shared hosting provider so I don’t have full access, but if you did you can use the free library called Pdftk, found here: PdfTk Toolkit, I will go into my end solution for shared hosting in my next post.

Fix Adobe Acrobat Licensing issue

January 18th, 2012
The other day I had a problem with my TurboTax software that I recently purchased in regards to using it on Windows 7 Ultimate 64 bit version, it just wouldn’t work.  In the process of trial and error of things I was trying on my machine to get TurboTax, I went into MSConfig and turned off all the microsoft services as part of my troubleshooting steps.  Apparently doing that also turned off something in the Adobe Acrobat licensing and was creating an error that looked like this:

I found that error online and its exactly like the one I am getting except the error code at the bottom there is 148:3 at the bottom, either way, this link is a link to a download tool that will take care of this problem: