Community
DWF
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set position for image resource

1 REPLY 1
Reply
Message 1 of 2
altai22
489 Views, 1 Reply

Set position for image resource

Have a nice day. I added image with DWF API, but how I can set rotation and position on sheet for image resource?

 

 

 

DWFImageResource* pImage =
                DWFCORE_ALLOC_OBJECT( DWFImageResource(L"Barcode",                     // title
                                                       DWFXML::kzRole_Graphics2d,        // role
                                                       DWFMIME::kzMIMEType_PNG,             // MIME type
                                                       L"me.",                   // author
                                                       L"Overlay barcode",             // description
                                                       L"",                                 // creation time
                                                       L"") );                              // modification time
            if (pImage == NULL)
            {
                _DWFCORE_THROW( DWFMemoryException, L"Failed to allocate resource" );
            }
            double anTransform[4][4] =     { 0.1, 0, 0, 0,
                                         0, 0.02, 0, 0,
                                         0, 0, 1, 0,
                                         0, 0.583333, 0, 1 };
            double anClip[4] = {0, 0, 11, 8.5 };
            double anOrigExtents[4] = {0, 0, 100, 75 };
            pImage->configureGraphic( (const double*)anTransform,
                                      NULL,
                                      (const double*)anClip, true, 1 );
            pImage->configureImage( 0, false, false, 0, anOrigExtents );
            DWFFile oJPGFilename( L"barcode.png" );
            DWFStreamFileDescriptor* pJPGFile = DWFCORE_ALLOC_OBJECT( DWFStreamFileDescriptor(oJPGFilename, L"rb") );

            if (pJPGFile == NULL)
            {
                DWFCORE_FREE_OBJECT( pImage );

                _DWFCORE_THROW( DWFMemoryException, L"Failed to allocate file descriptor" );
            }

            DWFFileInputStream* pJPGFilestream = DWFCORE_ALLOC_OBJECT( DWFFileInputStream );

            if (pJPGFilestream == NULL)
            {
                DWFCORE_FREE_OBJECT( pImage );
                DWFCORE_FREE_OBJECT( pJPGFile );

                _DWFCORE_THROW( DWFMemoryException, L"Failed to allocate file stream" );
            }
            pJPGFile->open();
            pJPGFilestream->attach( pJPGFile, true );
            pImage->setInputStream( pJPGFilestream );
      

// Adding Image to section

 

pSection->addResource(pImage,true);

1 REPLY 1
Message 2 of 2
altai22
in reply to: altai22

Anybody can help me with q?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services