| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfdoc/cpvt_generateap.h" | 7 #include "core/fpdfdoc/cpvt_generateap.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 421 } |
| 422 if (sBody.GetSize() > 0) { | 422 if (sBody.GetSize() > 0) { |
| 423 sAppStream << "/Tx BMC\nq\n" | 423 sAppStream << "/Tx BMC\nq\n" |
| 424 << rcBody.left << " " << rcBody.bottom << " " | 424 << rcBody.left << " " << rcBody.bottom << " " |
| 425 << rcBody.Width() << " " << rcBody.Height() << " re\nW\nn\n" | 425 << rcBody.Width() << " " << rcBody.Height() << " re\nW\nn\n" |
| 426 << sBody.AsStringC() << "Q\nEMC\n"; | 426 << sBody.AsStringC() << "Q\nEMC\n"; |
| 427 } | 427 } |
| 428 } break; | 428 } break; |
| 429 } | 429 } |
| 430 if (pNormalStream) { | 430 if (pNormalStream) { |
| 431 pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), | 431 pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, |
| 432 sAppStream.GetSize(), FALSE, FALSE); | 432 FALSE); |
| 433 pStreamDict = pNormalStream->GetDict(); | 433 pStreamDict = pNormalStream->GetDict(); |
| 434 if (pStreamDict) { | 434 if (pStreamDict) { |
| 435 pStreamDict->SetAtMatrix("Matrix", matrix); | 435 pStreamDict->SetAtMatrix("Matrix", matrix); |
| 436 pStreamDict->SetAtRect("BBox", rcBBox); | 436 pStreamDict->SetAtRect("BBox", rcBBox); |
| 437 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); | 437 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); |
| 438 if (pStreamResList) { | 438 if (pStreamResList) { |
| 439 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); | 439 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); |
| 440 if (!pStreamResFontList) { | 440 if (!pStreamResFontList) { |
| 441 pStreamResFontList = new CPDF_Dictionary; | 441 pStreamResFontList = new CPDF_Dictionary; |
| 442 pStreamResList->SetAt("Font", pStreamResFontList); | 442 pStreamResList->SetAt("Font", pStreamResFontList); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 CPDF_Dictionary* pAnnotDict, | 487 CPDF_Dictionary* pAnnotDict, |
| 488 const CFX_ByteTextBuf& sAppStream, | 488 const CFX_ByteTextBuf& sAppStream, |
| 489 CPDF_Dictionary* pExtGStateDict) { | 489 CPDF_Dictionary* pExtGStateDict) { |
| 490 CPDF_Dictionary* pAPDict = new CPDF_Dictionary; | 490 CPDF_Dictionary* pAPDict = new CPDF_Dictionary; |
| 491 pAnnotDict->SetAt("AP", pAPDict); | 491 pAnnotDict->SetAt("AP", pAPDict); |
| 492 | 492 |
| 493 CPDF_Stream* pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); | 493 CPDF_Stream* pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); |
| 494 int32_t objnum = pDoc->AddIndirectObject(pNormalStream); | 494 int32_t objnum = pDoc->AddIndirectObject(pNormalStream); |
| 495 pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum); | 495 pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum); |
| 496 | 496 |
| 497 pNormalStream->SetData(reinterpret_cast<uint8_t*>(sAppStream.GetBuffer()), | 497 pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, |
| 498 sAppStream.GetSize(), FALSE, FALSE); | 498 FALSE); |
| 499 | 499 |
| 500 CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); | 500 CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); |
| 501 pStreamDict->SetAtInteger("FormType", 1); | 501 pStreamDict->SetAtInteger("FormType", 1); |
| 502 pStreamDict->SetAtString("Subtype", "Form"); | 502 pStreamDict->SetAtString("Subtype", "Form"); |
| 503 pStreamDict->SetAtMatrix("Matrix", CFX_Matrix()); | 503 pStreamDict->SetAtMatrix("Matrix", CFX_Matrix()); |
| 504 | 504 |
| 505 CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect"); | 505 CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect"); |
| 506 pStreamDict->SetAtRect("BBox", rect); | 506 pStreamDict->SetAtRect("BBox", rect); |
| 507 | 507 |
| 508 CPDF_Dictionary* pResourceDict = new CPDF_Dictionary; | 508 CPDF_Dictionary* pResourceDict = new CPDF_Dictionary; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 int32_t nFontIndex, | 960 int32_t nFontIndex, |
| 961 FX_FLOAT fFontSize) { | 961 FX_FLOAT fFontSize) { |
| 962 CFX_ByteTextBuf sRet; | 962 CFX_ByteTextBuf sRet; |
| 963 if (pFontMap) { | 963 if (pFontMap) { |
| 964 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); | 964 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); |
| 965 if (sFontAlias.GetLength() > 0 && fFontSize > 0) | 965 if (sFontAlias.GetLength() > 0 && fFontSize > 0) |
| 966 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; | 966 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; |
| 967 } | 967 } |
| 968 return sRet.MakeString(); | 968 return sRet.MakeString(); |
| 969 } | 969 } |
| OLD | NEW |