DWF

Reply
Member
altai22
Posts: 3
Registered: ‎08-01-2013
Message 1 of 2 (231 Views)

Set position for image resource

231 Views, 1 Replies
08-01-2013 06:49 AM

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);

Member
altai22
Posts: 3
Registered: ‎08-01-2013
Message 2 of 2 (200 Views)

Re: Set position for image resource

08-15-2013 11:32 PM in reply to: altai22

Anybody can help me with q?

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.