Below is the code I've developed to write the pdf to a bmp. I first read the table on line 2, the originjal pdf is on line 28. Lines 19 through 34 populate the text fields. At line 38, I'm doing a convert.bindpdf on the same pdf file and not on the one that has the filled in fields. I believe the problem is that I don't know where the pdf with the filled in fields is located so I can do a converter.bindpdf at line 38. Line 40 is correct because I can open the bmp file and see the blank fields.
I hope I've correctly described the situation and I would appreciate any assistance you can offer.
1. SqlConnection conn = new SqlConnection((string)Session["DBConnectionString"]);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
2. SqlCommand cmd = new SqlCommand ("Select * from TempContracts where TempContractID=" + Session["NewContractRowID"],conn);
3. conn.Open();
4. SqlDataReader reader = cmd.ExecuteReader();
5. if (reader.Read())
6. {
7. sBusinessId = (PackerID); // ConvertDB(reader["PIN"]);
8. sPIN=ConvertDB(reader["PIN"]);
9. sContactFirstName = ConvertDB(reader["ContactFirstName"]);
10. sContactLastName = ConvertDB(reader["ContactLastName"]);
11. sContactTitle = ConvertDB(reader["ContactTitle"]);
12. sSubmissionDate=ConvertDB(reader["SubmissionDate"]);
13. sPhoneNumber=ConvertDB(reader["PhoneNumber"]);
14. }
15. FDFACXLib.FdfApp FDFAcX = new FDFACXLib.FdfApp();
16. FDFACXLib.FdfDoc objFDF = (FDFACXLib.FdfDoc)FDFAcX.FDFCreate();
17. Uri baseuri = new Uri(BaseURILink);
18. Uri myUri = new Uri(baseuri, "MediaLibrary/OptionalCover102510.pdf");
19. objFDF.FDFSetFile(myUri.AbsoluteUri); objFDF.FDFSetValue("b12c96nfFirmName", PackerName, false);
20. objFDF.FDFSetValue("BusinessId", PackerID, false);
21. objFDF.FDFSetValue("b12c96nfContactFirstName", sContactFirstName, false);
22. objFDF.FDFSetValue("b12c96nfContactLastName", sContactLastName, false);
23. objFDF.FDFSetValue("b12c96nfTitle", sContactTitle, false);
24. objFDF.FDFSetValue("b12c96nfPIN", sPIN, false);
25. objFDF.FDFSetValue("b12c96nfPlantName", ((String)Session["sesPlantName1"]),false);
26. objFDF.FDFSetValue("b12c96nfPlantCity", ((String)Session["sesLocation1"]),false);
27. objFDF.FDFSetValue("b12c96nfPlantCity", ((String)Session["sesLocation1"]), false);
28. objFDF.FDFSetValue("b12c96nfDateOfSubmit", sSubmissionDate, false);
29. objFDF.FDFSetValue("b12c96nfDateEffective", sSubmissionDate, false);
30. objFDF.FDFSetValue("b12c96nfCertifierFirstName", sContactFirstName, false);
31. objFDF.FDFSetValue("b12c96nfCertifierLastName", sContactLastName, false);
32. objFDF.FDFSetValue("b12c96nfCertifierTitle", sContactTitle, false);
33. objFDF.FDFSetValue("b12c96nfPhoneNumber", sPhoneNumber, false);
34. objFDF.FDFSetValue("b12c96nfExistingContractID", sContactTitle, false);
35. Response.ContentType = "application/vnd.fdf";
36. Response.BinaryWrite((byte[])objFDF.FDFSaveToBuf());
37. PdfConverter converter = new PdfConverter();
38. converter.BindPdf(@"C:\Inetpub\wwwroot\Swine\MediaLibrary\OptionalCover102510.pdf");
39. converter.DoConvert();
40. String prefix = @"C:\Temp\";
41. String suffix = ".bmp";
42. int imageCount = 1;
43. while (converter.HasNextImage())
44. {
45. converter.GetNextImage(prefix + imageCount + suffix);
46. imageCount++;
47. }
48. objFDF.FDFClose();
49. Response.End();
50. reader.Close();
51. conn.Close();