PDF created with nsIWebBrowserPrint interface has no text

UNCONFIRMED
Unassigned

Status

()

Core
Printing: Output
UNCONFIRMED
7 years ago
4 years ago

People

(Reporter: A.Horak, Unassigned)

Tracking

9 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 590136 [details]
google_page_no fonts.pdf

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20111220165912

Steps to reproduce:

Create PDF document over nsIWebBrowserPrint using Mozilla Embedding Wrapper and  nsIPrintSettings::kOutputFormatPDF. I used the current version of Firefox 9.0.1.

Here is the code:
...
nsID xWebBrowserPrint = NS_IWEBBROWSERPRINT_IID;
nsIWebBrowserPrint* pnsIWebBrowserPrint = NULL;
	if(pInterfaceRequestor)
		pInterfaceRequestor->GetInterface(xWebBrowserPrint, (void**)&pnsIWebBrowserPrint);

	nsID xIDPrintSettings = NS_IPRINTSETTINGS_IID;
	nsIPrintSettings* pnsIPrintSettings = NULL;	


	if(!pnsIPrintSettings && pnsIWebBrowserPrint)
	{
		nsIPrintSettings* pnsTmpIPrintSettings = NULL;	
		
		pnsIWebBrowserPrint->GetGlobalPrintSettings(&pnsTmpIPrintSettings);
		if(pnsTmpIPrintSettings)
			pnsTmpIPrintSettings->Clone(&pnsIPrintSettings);				
	}

	if(pnsIPrintSettings)
	{	
		HWND hWnd = (HWND) m_pMozView->GetNativeWindow();

		double dMMPaperWidth = 210;
		double dMMPaperHeight = 5080 ; // use a very very huge value to make sure it fits on one page
		// 5080 mm = 200 Inches -> maximale pdf seitengroesse

		if(hWnd)
		{
			RECT rcRenderWnd;
			::GetWindowRect(hWnd, &rcRenderWnd); // wnd should have content size
			ASSERT(rcRenderWnd.left == 0);
			ASSERT(rcRenderWnd.top == 0);

			nsIntMargin oMargin(0,0,0,0);
			pnsIPrintSettings->SetMarginInTwips(oMargin);

			XTRACE(0, _T("rcRenderWnd.right = %d"), rcRenderWnd.right);
			XTRACE(0, _T("rcRenderWnd.bottom = %d"), rcRenderWnd.bottom);
			dMMPaperWidth = 1 + rcRenderWnd.right/96.0 * 25.4;    // calc width in mm based on window taht was resized by ShrinkToFit			
		}
				
		pnsIPrintSettings->SetPaperWidth(dMMPaperWidth);
		pnsIPrintSettings->SetPaperHeight(dMMPaperHeight);
		pnsIPrintSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
		pnsIPrintSettings->SetShrinkToFit(PR_TRUE);
		
		pnsIPrintSettings->SetPrintSilent(PR_TRUE);
		pnsIPrintSettings->SetShowPrintProgress(PR_FALSE);		
		pnsIPrintSettings->SetPrintToFile(PR_TRUE);

		pnsIPrintSettings->SetPrintBGColors(PR_TRUE);
		pnsIPrintSettings->SetPrintBGImages(PR_TRUE);		

		pnsIPrintSettings->SetDocURL(_T(""));
		pnsIPrintSettings->SetTitle(_T(""));
		pnsIPrintSettings->SetHeaderStrLeft(_T(""));
		pnsIPrintSettings->SetHeaderStrCenter(_T(""));
		pnsIPrintSettings->SetHeaderStrRight(_T(""));
		pnsIPrintSettings->SetFooterStrLeft(_T(""));
		pnsIPrintSettings->SetFooterStrCenter(_T(""));
		pnsIPrintSettings->SetFooterStrRight(_T(""));
				
		m_sTmpPDFFile.Empty();
		GetTempFile(m_sTmpPDFFile);
		ASSERT(!m_sTmpPDFFile.IsEmpty());
		pnsIPrintSettings->SetToFileName(m_sTmpPDFFile);
		pnsIPrintSettings->SetOutputFormat(nsIPrintSettings::kOutputFormatPDF);

		//gehen beide leider direkt auf drucker :-(
		//pnsIPrintSettings->SetOutputFormat(nsIPrintSettings::kOutputFormatNative);		
		//pnsIPrintSettings->SetOutputFormat(nsIPrintSettings::kOutputFormatPS);		

		pnsIPrintSettings->SetupSilentPrinting();
	}

	if(pnsIWebBrowserPrint)
	{				
		nsCOMPtr<MyPrintProgressListener> pListener = new MyPrintProgressListener(this, m_pHrJob);		

		pnsIWebBrowserPrint->Print(pnsIPrintSettings, pListener);
		
		// MyPrintProgressListener handles the result
	}



Actual results:

This works fine under Windows XP. But under Windows 7 64-Bit the text elements of the webpage are not visible.
please see attached PDF showing google webpage! 


Expected results:

It looks like a problem with the embedded fonts.

Comment 1

7 years ago
related to Bug 653336

Updated

4 years ago
Component: Untriaged → Printing: Output
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.