insert png image into pdf


i found width , height of png image.

 

but when m calling addimagesnip() after shown message "out of memory".

 

while select jpg file , found width , height of jpg file after m calling addimagesnip() function image inserted pdf successfully.

 

why fuction not working png format ?

 

can 1 tell me how set value of pdeimagematrix , parameter passing pdeimagecreate() function png image file......?

 

 

pdeimage volatile pdeimage = null;

                    pdeimageattrs pdeimageattrs;

                    pdecolorspace pdecolorspace;

                    asfixedmatrix imagematrix;

 

                    memset(&pdeimageattrs, 0, sizeof(pdeimageattrs));

                    pdeimageattrs.flags = kpdeimageexternal;

                    pdeimageattrs.width = width;

                    pdeimageattrs.height = height;

                    pdeimageattrs.bitspercomponent = 8;

 

                    imagematrix.a = asint16tofixed(width);

                    imagematrix.d = asint16tofixed(height);

                    imagematrix.b = imagematrix.c = fixedzero;

                    imagematrix.h = fixedzero;

                    imagematrix.v = fixedzero;

 

                    pdecolorspace = pdecolorspacecreatefromname(asatomfromstring("devicergb"));

 

                    pdefilterarray filterarray;

                    pdefilterspec filterspec;

                    memset (&filterspec, 0, sizeof (pdefilterspec));

                    filterspec.name = asatomfromstring ("dctdecode");//flatedecode //dctdecode

                    filterarray.numfilters = 1;

                    filterarray.spec[0] = filterspec;

                    astfilepos size =  asfilegeteof(asfile);

                    during

                              pdeimage = pdeimagecreate (&pdeimageattrs, sizeof(pdeimageattrs), &imagematrix,

                                                                                                    kpdeimageencodeddata , pdecolorspace, null,&filterarray,

                                                                                                    asstm, null, asfilegeteof(asfile));

                    handler

                              ierrorcode = asgetexceptionerrorcode();

                    end_handler

 

 

                    if (0 == ierrorcode)

                    {

                              pdpage pdpage;

                              pdecontent pdecontent;

                              pddoc doc=null;

                              if(!createpdf)

                              {

                                        avdoc avdoc = avappgetactivedoc();

                                        doc = avdocgetpddoc(avdoc);

                                        pdpage = pddocacquirepage (doc, 0);

                              }

                              else

                              {

                                        doc=pddoccreate();

                                        asfixedrect mediabox = {asint32tofixed(0), asint32tofixed(0), asint32tofixed(width), asint32tofixed(height)};   

                                        pdpage = pddoccreatepage(doc, pdbeforefirstpage, mediabox);

                              }

                              if(pdpage == null)

                                        return null;

                              pdecontent = pdpageacquirepdecontent (pdpage, gextensionid);

                              asint32 initialnumelements  = pdecontentgetnumelems(pdecontent);

                              pdeimage existingimage;

                              if(initialnumelements > 0)

                              {

                                        existingimage = (pdeimage) pdecontentgetelem(pdecontent, 0);

                                        asuns32 encodedlenp;

                                        asbool isencoded = pdeimagedataisencoded(existingimage,&encodedlenp);

                              }

 

                              during

                                        pdeelement pdeelement=(pdeelement)pdeimage;.

                                        pdecontentaddelem (pdecontent, kpdeafterlast, pdeelement );

                              handler

                                        ierrorcode = asgetexceptionerrorcode();

                              end_handler

 

                              asint32 finalnumelements  = pdecontentgetnumelems(pdecontent);

                              asbool sucess = pdpagesetpdecontent (pdpage, gextensionid);

                              pdpagereleasepdecontent (pdpage, gextensionid);

 

 

this code correct jpg not working png.

 

can 1 tell me why not working png ?



More discussions in Acrobat SDK


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues