Free Support Forum - aspose.com

Inserting image into pdf from without scaling

Below is a segment of code I am using to fill in a form. Each time through the loop i need to put an image in based on data from the database. There are two different images which are different sizes. When I put them in they scale to the size of the field, which is a button. I have even set the properties to neever scale.

I am looking for suggestions. Also is it possible to open a pdf in a PDF object then access the Form object from that one?

form_venueDetails = new Form(reportspath + "/templates/CafeScreen_Installed_Venues.pdf", reportspath + "/dynamicreports/" + basename + "_p" + pagenum.ToString() + ".pdf");

rowcount = dv.Count;
foreach (DataRowView dr in dv)
{
liveVenues.venuedetailssheetRow drTyped = (liveVenues.venuedetailssheetRow)dr.Row;

form_venueDetails.FillField(field_cafe + i.ToString("00"), drTyped.locationname);
form_venueDetails.FillImageField("screen_img_" + i.ToString("00"), reportspath + "/templates/screen_" + drTyped.screensize.ToString() + ".gif");



i += 1;
if (i > 12 && (((pagenum -1) * maxVenuesPerPage) + i) < rowcount)
{
form_venueDetails.FlattenAllFields();

form_venueDetails.Save();
i = 1;
pagenum += 1;
form_venueDetails = new Form(reportspath + "/templates/CafeScreen_Installed_Venues.pdf", reportspath + "/dynamicreports/" + basename + "_p" + pagenum.ToString() + ".pdf");

}



}


This message was posted using Aspose.Live 2 Forum

Dear JasonPotter,

Thanks for considering Aspose.Pdf.Kit.

Would you please provide the resources (including the PDF template "CafeScreen_Installed_Venues.pdf" as well as those two images) in this thread or to my mail luke.fu@aspose.com? I will check it for you.

And I am not very clear about your second question, especially the PDF object you mentioned. Please explain what you are going to do, thanks a lot.

Best regards.

In Regard to the second question, i want do do something like the following.

Pdf objpdf = new Pdf(‘existingpdfwithform.pdf’);

Form objform = objpdf.getForm();

objform.fillfield(‘testfield’,‘some random text’);


Regards
jason

Dear JasonPotter,

I got the resources from mail and reproduced the problem. Your requirement is to remain the original size of those two GIF images, right? I reported it in our bug system as [PDFKITNET-4437]. The ETA is about two weeks.

Best regards.

Dear JasonPotter,

About your second question, it was completely supported by Aspose.Pdf.Kit. Actually you can use the following code to meet your requirement:

Form objform = new Form("existingpdfwithform.pdf", "outputpdfwithform.pdf");

objform.fillfield("testfield", "some random text");

objform.Save();

An output file( or stream) will be produced which contains the filled field. More details please refer to our API or Demos.

Best regards.

Dear JasonPotter,

This problem has been fixed. The output file has been sent to you, please help us to check it. If it is exactly what you need, the next release will include this promotion. Thanks.

Best regards.

Hi There,

I did not receive the new file via email. Could you resent or post here.

Regards
Jason

Dear JasonPotter,

Sorry to hear that. I sent it again, and also posted it here. Please check it.

Best regards.