DWF

DWF

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

Set position for image resource

239 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 (208 Views)

Re: Set position for image resource

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

Anybody can help me with q?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.