当前位置: 首页>>代码示例>>C++>>正文


C++ PDFPage::GetRotate方法代码示例

本文整理汇总了C++中PDFPage::GetRotate方法的典型用法代码示例。如果您正苦于以下问题:C++ PDFPage::GetRotate方法的具体用法?C++ PDFPage::GetRotate怎么用?C++ PDFPage::GetRotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PDFPage的用法示例。


在下文中一共展示了PDFPage::GetRotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Run

EStatusCode RotatedPagesPDF::Run(const TestConfiguration& inTestConfiguration)
{
	LogConfiguration logConfiguration(true,true,RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"RotatedPagesLog.txt"));
	EStatusCode status; 

	do
	{
		// PDF Page rotation writing

		PDFWriter pdfWriter;
		status = pdfWriter.StartPDF(
			RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"RotatedPages.pdf"),
			ePDFVersion13,logConfiguration);

		if(status != PDFHummus::eSuccess)
		{
			cout<<"failed to start RotatedPages.pdf\n";
			break;
		}	

		AbstractContentContext::TextOptions textOptions(pdfWriter.GetFontForFile(
																			RelativeURLToLocalPath(
                                                                            inTestConfiguration.mSampleFileBase,
                                                                            "TestMaterials/fonts/arial.ttf")),
																			14,
																			AbstractContentContext::eGray,
																			0);

		for(int i=0;i<6 && PDFHummus::eSuccess == status;++i)
		{
			PDFPage page;
			page.SetMediaBox(PDFRectangle(0,0,595,842));

			page.SetRotate(33);
			if ( page.GetRotate().second != 0 )
			{
				status = PDFHummus::eFailure;
				cout<<"Failed to reject invalid rotation\n";
				break;
			}
			
			page.SetRotate(i*90);
		
			std::ostringstream s;
			s << "Page rotated by " << i*90 << " degrees.";

			PageContentContext* cxt = pdfWriter.StartPageContentContext(&page);
			cxt->WriteText(75,805,s.str(),textOptions);
			status = pdfWriter.EndPageContentContext(cxt);
			if(status != eSuccess)
			{
				status = PDFHummus::eFailure;
				cout<<"Failed to end content context\n";
				break;
			}

			status = pdfWriter.WritePage(&page);
			if(status != PDFHummus::eSuccess)
				cout<<"failed to write page "<<i<<"\n";
		}

		status = pdfWriter.EndPDF();
		if(status != PDFHummus::eSuccess)
		{
			cout<<"failed in end RotatedPages.pdf\n";
			break;
		}


		// PDF page rotation copy
        
		status = pdfWriter.StartPDF(
			RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"RotatedPagesCopy.pdf"),
			ePDFVersion13);

		if(status != PDFHummus::eSuccess)
		{
			cout<<"failed to start RotatedPagesCopy.pdf\n";
			break;
		}
        
		EStatusCodeAndObjectIDTypeList result;
        
        // append pages
		result = pdfWriter.AppendPDFPagesFromPDF(
			RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"RotatedPages.pdf"),
			PDFPageRange());

		if(result.first != PDFHummus::eSuccess)
		{
			cout<<"failed to append pages from RotatedPages.pdf\n";
			status = result.first;
			break;
		}
        
		status = pdfWriter.EndPDF();

		if(status != PDFHummus::eSuccess)
		{
			cout<<"failed in end RotatedPagesCopy.pdf\n";
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的PDFPage::GetRotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。