Problem with adding an image using PdfFileMend and .AddImage

Last post 05-05-2010, 7:24 PM by aspose.notifier. 13 replies.
Sort Posts: Previous Next
  •  02-23-2010, 11:13 AM 223612

    Problem with adding an image using PdfFileMend and .AddImage .NET

    Attachment: Present (inaccessible)
    here is my code to place a basic image on a pdf:


    PdfFileMend mendor;
    mendor = new PdfFileMend("bpmpe004.pdf",  "new.pdf");
    mendor.AddImage("TOLOGO.jpg", 1, 116, 707, 299, 759);
    mendor.Close();


    Here is the overload I am using:
    public bool AddImage(string imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY);


    It seems no matter what I put for the upperRightX or upperRightY , it does not change anything. Only the lowerLeftX and lowerLeftY really affect the placement of the image.

    I've run many tests other than the above code.

    This was working fine in version 3.5.0, but I had to upgrade to 4.1.0 after I bought a license.
    Filed under: AddImage;PdfFileMend
     
  •  02-23-2010, 12:47 PM 223633 in reply to 223612

    Re: Problem with adding an image using PdfFileMend and .AddImage

    After some more testing, I was able to get the Licensing and AddImage to work with version 3.8.0.1, but AddImage does not work on subsequent versions.

    Also after 3.8.0.1 using streams with AddImage does not work either:

    using (FileStream inImgStream = new FileStream("TOLOGO.jpg", FileMode.Open))
    {
    PdfFileMend mendor;
    mendor = new PdfFileMend("bpmpe004.pdf",  "new.pdf");
    mendor.AddImage(inImgStream, 1, 116, 707, 299, 759);
    mendor.Close();
    inImgStream.Close();
    }

    If you run this you get the:
    "Object reference not set to an instance of an object"

     
  •  02-24-2010, 7:28 AM 223792 in reply to 223633

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Hi Zen,

    I have tested these problems at my end and reproduced both of these issues. These issues have been logged in our issue tracking system as under:

    PDFKITNET-14635 - Image is not placed properly
    PDFKITNET-14637 - Problem adding image from a Stream

    Our team will look into these issues and you'll be updated via this forum thread once the issues are resolved.

    We're sorry for the inconvenience.
    Regards,




    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-03-2010, 3:28 PM 225222 in reply to 223612

    Re: Problem with adding an image using PdfFileMend and .AddImage

    The issues you have found earlier (filed as 14635;14637) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
  •  03-22-2010, 4:12 AM 228372 in reply to 223792

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Hi Shahzad,

    We just tried updating the aspose.pdf.kit from 4.0.0 to 4.2.0.
    After testing we notice the above error, when adding a .png image from a MemoryStream.

    When modifying our code to the above sample we keep getting a System.ArgumentException with the message: 'Parameter is not valid.'. (also on the Stream, int, float, float, float, float overload)
    Our code was confirmed to work in 3.5.0 and 4.0.0, after updating it throws the above exception.

    It seems that PDFKITNET-14637 is not yet solved?
    Can you confirm this error or maybe a solution this problem?


    Sincerely,
    Freddy
     
  •  03-22-2010, 7:52 AM 228403 in reply to 228372

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Hi Freddy,

    I have tested this issue using Aspose.Pdf.Kit for .NET 4.2.0, MemoryStram and a PNG image, but I couldn't see any problem. Can you please make sure that the reference to the latest DLL was added successfully? If you still find any problem then please share your sample files (PDF and PNG) along with the code snippet, so we would be able to test the issue using your particular scenario.

    We're sorry for the inconvenience.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-22-2010, 9:13 AM 228411 in reply to 228403

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Attachment: Present (inaccessible)

    This is the code snippet we use:

    This fails: (System.ArgumentException with message = 'Parameter is not valid.')

    PdfFileInfo fileInfo = new PdfFileInfo(pdffile);
    float height = fileInfo.GetPageHeight(pageIndex);
    float width = fileInfo.GetPageWidth(pageIndex);

    using (FileStream inImgStream = new FileStream("d:\\barcode.png", FileMode.Open))
    {
      PdfFileMend mendor = new PdfFileMend(pdffile, output);
      mendor.AddImage(inImgStream, 1, 0, 0, width, height);
      mendor.Close();
      inImgStream.Close();
    }

    This works:
    PdfFileMend mendor = new PdfFileMend(pdffile, output);
    mendor.AddImage(
    "d:\\barcode.png", 1, 0, 0, width, height);
    mendor.Close();


    (please note that with these files the transparency ends up as black in the output file.)


    Sincerely,
    Freddy

     
  •  03-23-2010, 1:59 PM 228683 in reply to 228411

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Hi Freddy,

    I have reproduced this problem at my end and logged it as PDFKITNET-15314 in our issue tracking system. Our team will look into this issue and you'll be updated via this forum thread once it is resolved.

    We're sorry for the inconvenience.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  03-30-2010, 2:42 AM 229780 in reply to 223612

    Re: Problem with adding an image using PdfFileMend and .AddImage

    The issues you have found earlier (filed as 15314) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
  •  03-31-2010, 6:31 AM 230062 in reply to 229780

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Attachment: Present (inaccessible)

    Hello,

    It seems that the above fix breaks the transparent png functionality. (transparent png from stream into pdf) See the attached files (one made with 4.0.0 and one made with 4.3.0)

    The 4.3.0 version gives black pages, the 4.0.0 works as it should.

    We really need to get the latest version running because of the memory usage related errors in pre-4.2.0, but we keep running into problems. If we cannot get the problem fixed, we are forced by our customer to find a solution with other components..

    Is it possible to do a quick-fix so we can start using the new version? (would within a few days be reasonable?)

    Sincerely,
    Fred

     
  •  03-31-2010, 11:31 AM 230145 in reply to 230062

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Hi Fred,

    We'll try to provide you a hotfix for this issue tomorrow.

    We're sorry for the inconvenience and appreciate your patience.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  04-01-2010, 1:55 AM 230227 in reply to 230145

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Thank you, i hope this solves our problems.

    Sincerely,
    Fred

     
  •  04-01-2010, 2:45 PM 230446 in reply to 230227

    Re: Problem with adding an image using PdfFileMend and .AddImage

    Attachment: Present (inaccessible)
    Hi Fred,

    Please find a hotfix attached with this post.

    I hope this helps. If you have any questions, please do let us know.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  05-05-2010, 7:24 PM 236433 in reply to 223612

    Re: Problem with adding an image using PdfFileMend and .AddImage

    The issues you have found earlier (filed as 15565) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
View as RSS news feed in XML