Exemplo n.º 1
0
void CDoubleSidedPrintPrePrint1::OnClickedPrint()
{
	CPmwApp* pApp = GET_PMWAPP();

	// Create a newsletter project.
	pApp->last_new_info.type = PROJECT_TYPE_Newsletter;
	pApp->last_new_info.subtype = 0;
	pApp->last_new_info.orientation = PORTRAIT;

	// Paper info is printer info.
	*(pApp->last_new_info.m_pPaperInfo) = *(pApp->GetPaperInfo(pApp->last_new_info.orientation));

	WORD wFlags = CPmwDoc::m_wGlobalDocumentFlags;
	CPmwDoc::m_wGlobalDocumentFlags |= CPmwDoc::FLAG_TestPrintDocument;
	CPmwDoc* pDoc = (CPmwDoc*)(pApp->m_pScratchTemplate->OpenDocumentFile(NULL, FALSE));
	CPmwDoc::m_wGlobalDocumentFlags = wFlags;

	if (pDoc != NULL)
	{
#ifndef WIN32
		pDoc->DoNewDocument(-1, FALSE);
#endif

		CPmwView* pView = pDoc->GetCurrentView();
		// We have one page so far. Add the key text to it.

		// Create the key frame with text saying "FACE UP".
		WORD wDoubleSidedType = DBLPRN_Valid;
		pView->CreateKeyFrame(wDoubleSidedType);
		pView->CreateKeyArrow(wDoubleSidedType);
		CreateLeftFrame(pView, "A");

		ASSERT(pDoc->NumberOfPages() == 1);

		// Create the second page.
		pDoc->AddPage(1);
		pDoc->GotoPage(1);

		pView->CreateKeyFrame(wDoubleSidedType);
		pView->CreateKeyArrow(wDoubleSidedType);
		CreateLeftFrame(pView, "B");

		// Set the title for the print-out.
		CString csTitle;
		TRY
			csTitle.LoadString(IDS_PrintTest1);
		END_TRY
		pDoc->SetTitle(csTitle);

		// Do the print-out.
		pView->PrintNoDialog();

		pDoc->OnCloseDocument();
	}
}
Exemplo n.º 2
0
BOOL CArtOleDropTarget::SaveClipObjectsToUserArt(COleDataObject* pDataObject, LPCTSTR pFilename)
{
	CPmwDoc* pTempDoc = GET_PMWAPP()->NewHiddenDocument();
	if (pTempDoc == NULL)
	{
		ASSERT(pTempDoc);
		return FALSE;
	}

	pTempDoc->size_to_paper();

	BOOL retval = TRUE;
	if ((clipboard.PasteObjectsFromDatabase(pTempDoc) != ERRORCODE_None) ||
		 (pTempDoc->SaveToFile(pFilename, TRUE) != TRUE))
	{
		retval = FALSE;
	}

	pTempDoc->OnCloseDocument();
	return retval;
}