IPXC_Document::CreateContentCreator Method
From PDF XChange PDF SDK
m (Automatic page editing by robot) |
m (Automatic page editing by robot) |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | __NOTOC__ | ||
[[Category:Editor]] | [[Category:Editor]] | ||
{{#customTitle:IPXC_Document::CreateContentCreator Method}} | {{#customTitle:IPXC_Document::CreateContentCreator Method}} | ||
− | {{#parentPage:PXV:IPXC_Document|CreateContentCreator | + | {{#parentPage:PXV:IPXC_Document#Methods|CreateContentCreator|method}} |
− | + | ||
{{ToReview}} | {{ToReview}} | ||
− | + | Creates new [[PXV:IPXC_ContentCreator|IPXC_ContentCreator]] object used for creation of PDF content. | |
== Syntax == | == Syntax == | ||
− | <pre class="brush:cpp;gutter:false">HRESULT CreateContentCreator([out, retval] IPXC_ContentCreator** | + | <pre class="brush:cpp;gutter:false">HRESULT CreateContentCreator([out, retval] IPXC_ContentCreator** pContentCreator);</pre> |
== Parameters == | == Parameters == | ||
− | ; | + | ;pContentCreator |
− | :[out, retval] | + | :[out, retval] Returns new [[PXV:IPXC_ContentCreator|IPXC_ContentCreator]] object. |
== Return Value == | == Return Value == | ||
− | Returns S_OK if operation was successful or error code in other cases. | + | Returns <tt>S_OK</tt> if operation was successful or error code in other cases. |
+ | |||
+ | == Sample == | ||
+ | <pre class="brush:cpp">HRESULT CreateDiamondPattern(IPXC_Document* pDoc, CComPtr<IPXC_Pattern>& pPattern) | ||
+ | { | ||
+ | pPattern = nullptr; | ||
+ | HRESULT hr = S_OK; | ||
+ | do | ||
+ | { | ||
+ | PXC_Rect bbox; | ||
+ | bbox.left = 0; | ||
+ | bbox.bottom = 0; | ||
+ | bbox.right = 16.0; | ||
+ | bbox.top = 16.0; | ||
+ | |||
+ | CComPtr<IPXC_ContentCreator> pCC; | ||
+ | hr = pDoc->CreateContentCreator(&pCC); | ||
+ | if (FAILED(hr)) | ||
+ | break; | ||
+ | |||
+ | pCC->MoveTo((bbox.left + bbox.right) / 2, bbox.bottom); | ||
+ | pCC->LineTo(bbox.right, (bbox.top + bbox.bottom) / 2); | ||
+ | pCC->LineTo((bbox.left + bbox.right) / 2, bbox.top); | ||
+ | pCC->LineTo(bbox.left, (bbox.top + bbox.bottom) / 2); | ||
+ | pCC->FillPath(VARIANT_TRUE, VARIANT_FALSE, FillRule_Winding); | ||
+ | |||
+ | hr = pDoc->CreateTilePattern(&bbox, &pPattern); | ||
+ | if (FAILED(hr)) | ||
+ | break; | ||
+ | |||
+ | CComPtr<PXC::IPXC_Content> pContent; | ||
+ | pCC->Detach(&pContent); | ||
+ | pContent->put_BBox(&bbox); | ||
+ | pPattern->SetContent(pContent, PlaceContent_Replace); | ||
+ | } while (false); | ||
+ | if (FAILED(hr)) | ||
+ | pPattern = nullptr; | ||
+ | return hr; | ||
+ | } | ||
+ | </pre> | ||
== See Also == | == See Also == | ||
− | + | [[PXV:IPXC_Document|IPXC_Document]] |
Latest revision as of 02:24, 15 June 2015
Creates new IPXC_ContentCreator object used for creation of PDF content.
Syntax
HRESULT CreateContentCreator([out, retval] IPXC_ContentCreator** pContentCreator);
Parameters
- pContentCreator
- [out, retval] Returns new IPXC_ContentCreator object.
Return Value
Returns S_OK if operation was successful or error code in other cases.
Sample
HRESULT CreateDiamondPattern(IPXC_Document* pDoc, CComPtr<IPXC_Pattern>& pPattern) { pPattern = nullptr; HRESULT hr = S_OK; do { PXC_Rect bbox; bbox.left = 0; bbox.bottom = 0; bbox.right = 16.0; bbox.top = 16.0; CComPtr<IPXC_ContentCreator> pCC; hr = pDoc->CreateContentCreator(&pCC); if (FAILED(hr)) break; pCC->MoveTo((bbox.left + bbox.right) / 2, bbox.bottom); pCC->LineTo(bbox.right, (bbox.top + bbox.bottom) / 2); pCC->LineTo((bbox.left + bbox.right) / 2, bbox.top); pCC->LineTo(bbox.left, (bbox.top + bbox.bottom) / 2); pCC->FillPath(VARIANT_TRUE, VARIANT_FALSE, FillRule_Winding); hr = pDoc->CreateTilePattern(&bbox, &pPattern); if (FAILED(hr)) break; CComPtr<PXC::IPXC_Content> pContent; pCC->Detach(&pContent); pContent->put_BBox(&bbox); pPattern->SetContent(pContent, PlaceContent_Replace); } while (false); if (FAILED(hr)) pPattern = nullptr; return hr; }