| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 default: | 217 default: |
| 218 break; | 218 break; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy) { | 222 FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy) { |
| 223 switch (policy) { | 223 switch (policy) { |
| 224 case FPDF_POLICY_MACHINETIME_ACCESS: | 224 case FPDF_POLICY_MACHINETIME_ACCESS: |
| 225 return !!(foxit_sandbox_policy & 0x01); | 225 return !!(foxit_sandbox_policy & 0x01); |
| 226 default: | 226 default: |
| 227 return FALSE; | 227 return false; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 CCodec_ModuleMgr* g_pCodecModule = nullptr; | 231 CCodec_ModuleMgr* g_pCodecModule = nullptr; |
| 232 | 232 |
| 233 DLLEXPORT void STDCALL FPDF_InitLibrary() { | 233 DLLEXPORT void STDCALL FPDF_InitLibrary() { |
| 234 FPDF_InitLibraryWithConfig(nullptr); | 234 FPDF_InitLibraryWithConfig(nullptr); |
| 235 } | 235 } |
| 236 | 236 |
| 237 DLLEXPORT void STDCALL | 237 DLLEXPORT void STDCALL |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 ProcessParseError(error); | 342 ProcessParseError(error); |
| 343 return nullptr; | 343 return nullptr; |
| 344 } | 344 } |
| 345 return FPDFDocumentFromCPDFDocument(pDocument.release()); | 345 return FPDFDocumentFromCPDFDocument(pDocument.release()); |
| 346 } | 346 } |
| 347 | 347 |
| 348 #ifdef PDF_ENABLE_XFA | 348 #ifdef PDF_ENABLE_XFA |
| 349 DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, | 349 DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, |
| 350 int* docType) { | 350 int* docType) { |
| 351 if (!document) | 351 if (!document) |
| 352 return FALSE; | 352 return false; |
| 353 | 353 |
| 354 CPDF_Document* pdfDoc = | 354 CPDF_Document* pdfDoc = |
| 355 (static_cast<CPDFXFA_Context*>(document))->GetPDFDoc(); | 355 (static_cast<CPDFXFA_Context*>(document))->GetPDFDoc(); |
| 356 if (!pdfDoc) | 356 if (!pdfDoc) |
| 357 return FALSE; | 357 return false; |
| 358 | 358 |
| 359 CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); | 359 CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); |
| 360 if (!pRoot) | 360 if (!pRoot) |
| 361 return FALSE; | 361 return false; |
| 362 | 362 |
| 363 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); | 363 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); |
| 364 if (!pAcroForm) | 364 if (!pAcroForm) |
| 365 return FALSE; | 365 return false; |
| 366 | 366 |
| 367 CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); | 367 CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); |
| 368 if (!pXFA) | 368 if (!pXFA) |
| 369 return FALSE; | 369 return false; |
| 370 | 370 |
| 371 bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); | 371 bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); |
| 372 *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; | 372 *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; |
| 373 return TRUE; | 373 return true; |
| 374 } | 374 } |
| 375 | 375 |
| 376 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { | 376 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { |
| 377 return document && (static_cast<CPDFXFA_Context*>(document))->LoadXFADoc(); | 377 return document && (static_cast<CPDFXFA_Context*>(document))->LoadXFADoc(); |
| 378 } | 378 } |
| 379 #endif // PDF_ENABLE_XFA | 379 #endif // PDF_ENABLE_XFA |
| 380 | 380 |
| 381 class CMemFile final : public IFX_SeekableReadStream { | 381 class CMemFile final : public IFX_SeekableReadStream { |
| 382 public: | 382 public: |
| 383 CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} | 383 CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 ProcessParseError(error); | 439 ProcessParseError(error); |
| 440 return nullptr; | 440 return nullptr; |
| 441 } | 441 } |
| 442 CheckUnSupportError(pDocument.get(), error); | 442 CheckUnSupportError(pDocument.get(), error); |
| 443 return FPDFDocumentFromCPDFDocument(pDocument.release()); | 443 return FPDFDocumentFromCPDFDocument(pDocument.release()); |
| 444 } | 444 } |
| 445 | 445 |
| 446 DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, | 446 DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, |
| 447 int* fileVersion) { | 447 int* fileVersion) { |
| 448 if (!fileVersion) | 448 if (!fileVersion) |
| 449 return FALSE; | 449 return false; |
| 450 | 450 |
| 451 *fileVersion = 0; | 451 *fileVersion = 0; |
| 452 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); | 452 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); |
| 453 if (!pDoc) | 453 if (!pDoc) |
| 454 return FALSE; | 454 return false; |
| 455 | 455 |
| 456 CPDF_Parser* pParser = pDoc->GetParser(); | 456 CPDF_Parser* pParser = pDoc->GetParser(); |
| 457 if (!pParser) | 457 if (!pParser) |
| 458 return FALSE; | 458 return false; |
| 459 | 459 |
| 460 *fileVersion = pParser->GetFileVersion(); | 460 *fileVersion = pParser->GetFileVersion(); |
| 461 return TRUE; | 461 return true; |
| 462 } | 462 } |
| 463 | 463 |
| 464 // jabdelmalek: changed return type from uint32_t to build on Linux (and match | 464 // jabdelmalek: changed return type from uint32_t to build on Linux (and match |
| 465 // header). | 465 // header). |
| 466 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) { | 466 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) { |
| 467 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 467 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 468 // https://bugs.chromium.org/p/pdfium/issues/detail?id=499 | 468 // https://bugs.chromium.org/p/pdfium/issues/detail?id=499 |
| 469 if (!pDoc) { | 469 if (!pDoc) { |
| 470 #ifndef PDF_ENABLE_XFA | 470 #ifndef PDF_ENABLE_XFA |
| 471 return 0; | 471 return 0; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 pBitmap->Create(size_x, size_y, FXDIB_Argb); | 547 pBitmap->Create(size_x, size_y, FXDIB_Argb); |
| 548 pBitmap->Clear(0x00ffffff); | 548 pBitmap->Clear(0x00ffffff); |
| 549 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; | 549 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; |
| 550 pContext->m_pDevice = pdfium::WrapUnique(pDevice); | 550 pContext->m_pDevice = pdfium::WrapUnique(pDevice); |
| 551 pDevice->Attach(pBitmap.get(), false, nullptr, false); | 551 pDevice->Attach(pBitmap.get(), false, nullptr, false); |
| 552 } else { | 552 } else { |
| 553 pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc); | 553 pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc); |
| 554 } | 554 } |
| 555 | 555 |
| 556 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, | 556 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
| 557 rotate, flags, TRUE, nullptr); | 557 rotate, flags, true, nullptr); |
| 558 | 558 |
| 559 if (bNewBitmap) { | 559 if (bNewBitmap) { |
| 560 CFX_WindowsDevice WinDC(dc); | 560 CFX_WindowsDevice WinDC(dc); |
| 561 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { | 561 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { |
| 562 std::unique_ptr<CFX_DIBitmap> pDst = pdfium::MakeUnique<CFX_DIBitmap>(); | 562 std::unique_ptr<CFX_DIBitmap> pDst = pdfium::MakeUnique<CFX_DIBitmap>(); |
| 563 int pitch = pBitmap->GetPitch(); | 563 int pitch = pBitmap->GetPitch(); |
| 564 pDst->Create(size_x, size_y, FXDIB_Rgb32); | 564 pDst->Create(size_x, size_y, FXDIB_Rgb32); |
| 565 FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y); | 565 FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y); |
| 566 pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap.get(), 0, 0, | 566 pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap.get(), 0, 0, |
| 567 FXDIB_BLEND_NORMAL, nullptr, FALSE, nullptr); | 567 FXDIB_BLEND_NORMAL, nullptr, false, nullptr); |
| 568 WinDC.StretchDIBits(pDst.get(), 0, 0, size_x, size_y); | 568 WinDC.StretchDIBits(pDst.get(), 0, 0, size_x, size_y); |
| 569 } else { | 569 } else { |
| 570 WinDC.SetDIBits(pBitmap.get(), 0, 0); | 570 WinDC.SetDIBits(pBitmap.get(), 0, 0); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 pPage->SetRenderContext(nullptr); | 574 pPage->SetRenderContext(nullptr); |
| 575 } | 575 } |
| 576 #endif // defined(_WIN32) | 576 #endif // defined(_WIN32) |
| 577 | 577 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 591 return; | 591 return; |
| 592 | 592 |
| 593 CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext; | 593 CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext; |
| 594 pPage->SetRenderContext(pdfium::WrapUnique(pContext)); | 594 pPage->SetRenderContext(pdfium::WrapUnique(pContext)); |
| 595 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; | 595 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; |
| 596 pContext->m_pDevice.reset(pDevice); | 596 pContext->m_pDevice.reset(pDevice); |
| 597 CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap); | 597 CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap); |
| 598 pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); | 598 pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); |
| 599 | 599 |
| 600 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, | 600 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
| 601 rotate, flags, TRUE, nullptr); | 601 rotate, flags, true, nullptr); |
| 602 | 602 |
| 603 pPage->SetRenderContext(nullptr); | 603 pPage->SetRenderContext(nullptr); |
| 604 } | 604 } |
| 605 | 605 |
| 606 #ifdef _SKIA_SUPPORT_ | 606 #ifdef _SKIA_SUPPORT_ |
| 607 DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, | 607 DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, |
| 608 int size_x, | 608 int size_x, |
| 609 int size_y) { | 609 int size_y) { |
| 610 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 610 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 611 if (!pPage) | 611 if (!pPage) |
| 612 return nullptr; | 612 return nullptr; |
| 613 | 613 |
| 614 CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext; | 614 CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext; |
| 615 pPage->SetRenderContext(pdfium::WrapUnique(pContext)); | 615 pPage->SetRenderContext(pdfium::WrapUnique(pContext)); |
| 616 CFX_FxgeDevice* skDevice = new CFX_FxgeDevice; | 616 CFX_FxgeDevice* skDevice = new CFX_FxgeDevice; |
| 617 FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y); | 617 FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y); |
| 618 pContext->m_pDevice.reset(skDevice); | 618 pContext->m_pDevice.reset(skDevice); |
| 619 FPDF_RenderPage_Retail(pContext, page, 0, 0, size_x, size_y, 0, 0, TRUE, | 619 FPDF_RenderPage_Retail(pContext, page, 0, 0, size_x, size_y, 0, 0, true, |
| 620 nullptr); | 620 nullptr); |
| 621 pPage->SetRenderContext(nullptr); | 621 pPage->SetRenderContext(nullptr); |
| 622 return recorder; | 622 return recorder; |
| 623 } | 623 } |
| 624 #endif | 624 #endif |
| 625 | 625 |
| 626 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) { | 626 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) { |
| 627 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 627 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 628 if (!page) | 628 if (!page) |
| 629 return; | 629 return; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 799 } |
| 800 | 800 |
| 801 void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, | 801 void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, |
| 802 FPDF_PAGE page, | 802 FPDF_PAGE page, |
| 803 int start_x, | 803 int start_x, |
| 804 int start_y, | 804 int start_y, |
| 805 int size_x, | 805 int size_x, |
| 806 int size_y, | 806 int size_y, |
| 807 int rotate, | 807 int rotate, |
| 808 int flags, | 808 int flags, |
| 809 FX_BOOL bNeedToRestore, | 809 bool bNeedToRestore, |
| 810 IFSDK_PAUSE_Adapter* pause) { | 810 IFSDK_PAUSE_Adapter* pause) { |
| 811 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 811 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 812 if (!pPage) | 812 if (!pPage) |
| 813 return; | 813 return; |
| 814 | 814 |
| 815 if (!pContext->m_pOptions) | 815 if (!pContext->m_pOptions) |
| 816 pContext->m_pOptions = pdfium::MakeUnique<CPDF_RenderOptions>(); | 816 pContext->m_pOptions = pdfium::MakeUnique<CPDF_RenderOptions>(); |
| 817 | 817 |
| 818 if (flags & FPDF_LCD_TEXT) | 818 if (flags & FPDF_LCD_TEXT) |
| 819 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; | 819 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 850 | 850 |
| 851 pContext->m_pDevice->SaveState(); | 851 pContext->m_pDevice->SaveState(); |
| 852 pContext->m_pDevice->SetClip_Rect( | 852 pContext->m_pDevice->SetClip_Rect( |
| 853 FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y)); | 853 FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y)); |
| 854 | 854 |
| 855 pContext->m_pContext = pdfium::MakeUnique<CPDF_RenderContext>(pPage); | 855 pContext->m_pContext = pdfium::MakeUnique<CPDF_RenderContext>(pPage); |
| 856 pContext->m_pContext->AppendLayer(pPage, &matrix); | 856 pContext->m_pContext->AppendLayer(pPage, &matrix); |
| 857 | 857 |
| 858 if (flags & FPDF_ANNOT) { | 858 if (flags & FPDF_ANNOT) { |
| 859 pContext->m_pAnnots = pdfium::MakeUnique<CPDF_AnnotList>(pPage); | 859 pContext->m_pAnnots = pdfium::MakeUnique<CPDF_AnnotList>(pPage); |
| 860 FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY; | 860 bool bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY; |
| 861 pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(), | 861 pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(), |
| 862 bPrinting, &matrix, FALSE, nullptr); | 862 bPrinting, &matrix, false, nullptr); |
| 863 } | 863 } |
| 864 | 864 |
| 865 pContext->m_pRenderer = pdfium::MakeUnique<CPDF_ProgressiveRenderer>( | 865 pContext->m_pRenderer = pdfium::MakeUnique<CPDF_ProgressiveRenderer>( |
| 866 pContext->m_pContext.get(), pContext->m_pDevice.get(), | 866 pContext->m_pContext.get(), pContext->m_pDevice.get(), |
| 867 pContext->m_pOptions.get()); | 867 pContext->m_pOptions.get()); |
| 868 pContext->m_pRenderer->Start(pause); | 868 pContext->m_pRenderer->Start(pause); |
| 869 if (bNeedToRestore) | 869 if (bNeedToRestore) |
| 870 pContext->m_pDevice->RestoreState(false); | 870 pContext->m_pDevice->RestoreState(false); |
| 871 } | 871 } |
| 872 | 872 |
| 873 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, | 873 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, |
| 874 int page_index, | 874 int page_index, |
| 875 double* width, | 875 double* width, |
| 876 double* height) { | 876 double* height) { |
| 877 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); | 877 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
| 878 if (!pDoc) | 878 if (!pDoc) |
| 879 return FALSE; | 879 return false; |
| 880 | 880 |
| 881 #ifdef PDF_ENABLE_XFA | 881 #ifdef PDF_ENABLE_XFA |
| 882 int count = pDoc->GetPageCount(); | 882 int count = pDoc->GetPageCount(); |
| 883 if (page_index < 0 || page_index >= count) | 883 if (page_index < 0 || page_index >= count) |
| 884 return FALSE; | 884 return false; |
| 885 CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index); | 885 CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index); |
| 886 if (!pPage) | 886 if (!pPage) |
| 887 return FALSE; | 887 return false; |
| 888 *width = pPage->GetPageWidth(); | 888 *width = pPage->GetPageWidth(); |
| 889 *height = pPage->GetPageHeight(); | 889 *height = pPage->GetPageHeight(); |
| 890 #else // PDF_ENABLE_XFA | 890 #else // PDF_ENABLE_XFA |
| 891 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); | 891 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); |
| 892 if (!pDict) | 892 if (!pDict) |
| 893 return FALSE; | 893 return false; |
| 894 | 894 |
| 895 CPDF_Page page(pDoc, pDict, true); | 895 CPDF_Page page(pDoc, pDict, true); |
| 896 *width = page.GetPageWidth(); | 896 *width = page.GetPageWidth(); |
| 897 *height = page.GetPageHeight(); | 897 *height = page.GetPageHeight(); |
| 898 #endif // PDF_ENABLE_XFA | 898 #endif // PDF_ENABLE_XFA |
| 899 | 899 |
| 900 return TRUE; | 900 return true; |
| 901 } | 901 } |
| 902 | 902 |
| 903 DLLEXPORT FPDF_BOOL STDCALL | 903 DLLEXPORT FPDF_BOOL STDCALL |
| 904 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) { | 904 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) { |
| 905 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 905 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 906 if (!pDoc) | 906 if (!pDoc) |
| 907 return TRUE; | 907 return true; |
| 908 CPDF_ViewerPreferences viewRef(pDoc); | 908 CPDF_ViewerPreferences viewRef(pDoc); |
| 909 return viewRef.PrintScaling(); | 909 return viewRef.PrintScaling(); |
| 910 } | 910 } |
| 911 | 911 |
| 912 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document) { | 912 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document) { |
| 913 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 913 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 914 if (!pDoc) | 914 if (!pDoc) |
| 915 return 1; | 915 return 1; |
| 916 CPDF_ViewerPreferences viewRef(pDoc); | 916 CPDF_ViewerPreferences viewRef(pDoc); |
| 917 return viewRef.NumCopies(); | 917 return viewRef.NumCopies(); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 if (!buffer) { | 1091 if (!buffer) { |
| 1092 *buflen = len; | 1092 *buflen = len; |
| 1093 } else if (*buflen >= len) { | 1093 } else if (*buflen >= len) { |
| 1094 memcpy(buffer, utf16Name.c_str(), len); | 1094 memcpy(buffer, utf16Name.c_str(), len); |
| 1095 *buflen = len; | 1095 *buflen = len; |
| 1096 } else { | 1096 } else { |
| 1097 *buflen = -1; | 1097 *buflen = -1; |
| 1098 } | 1098 } |
| 1099 return (FPDF_DEST)pDestObj; | 1099 return (FPDF_DEST)pDestObj; |
| 1100 } | 1100 } |
| OLD | NEW |