Skip to content

Commit

Permalink
Merge pull request #49 from iron-software/automate-merge-code
Browse files Browse the repository at this point in the history
Copy from IronPolyglot on 2024-12-09
  • Loading branch information
chaknith-ironsoftware authored Dec 11, 2024
2 parents 9a24791 + 14274f2 commit a74fd7e
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions IronPdfEngine.ProtoFiles/pdfium_pdf_document.proto
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ message PdfiumFontInfoP
string name = 3;
int32 type = 4;
uint32 descendant_font_obj_num = 5;
bool is_subsetted = 6;
}

message PdfiumFontInfoCollectionP
Expand Down
5 changes: 3 additions & 2 deletions IronPdfEngine.ProtoFiles/pdfium_text.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";
import "basic.proto";
import "pdfium_pdf_document.proto";
package ironpdfengineproto;

option java_package = "com.ironsoftware.ironpdf.internal.proto";
Expand All @@ -16,15 +17,15 @@ message PdfiumReplaceTextRequestP {
int32 page_index = 2;
string current_text = 3;
string new_text = 4;
optional string font_name = 5;
optional PdfiumFontInfoP custom_font = 5;
optional float custom_font_size = 6;
}

message PdfiumDrawTextRequestP {
PdfDocumentP document = 1;
int32 page_index = 2;
string text = 3;
string font_name = 4;
PdfiumFontInfoP font = 4;
double font_size = 5;
double x = 6;
double y = 7;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public final class Setting_Api {

public static IronPdfEngineConnection connectionMode = IronPdfEngineConnection.configure().withOfficialCloud();

public static final String IRON_PDF_ENGINE_VERSION = "2024.11.4";
public static final String IRON_PDF_ENGINE_VERSION = "2024.12.9";

public static int ironPdfEngineTimeout = 120;

Expand Down
2 changes: 1 addition & 1 deletion ironpdf-engine-pack/ironpdf-engine-linux-x64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ironpdf.engine.version>2024.11.4</ironpdf.engine.version>
<ironpdf.engine.version>2024.12.9</ironpdf.engine.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion ironpdf-engine-pack/ironpdf-engine-macos-arm64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ironpdf.engine.version>2024.11.4</ironpdf.engine.version>
<ironpdf.engine.version>2024.12.9</ironpdf.engine.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion ironpdf-engine-pack/ironpdf-engine-macos-x64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ironpdf.engine.version>2024.11.4</ironpdf.engine.version>
<ironpdf.engine.version>2024.12.9</ironpdf.engine.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion ironpdf-engine-pack/ironpdf-engine-windows-x64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ironpdf.engine.version>2024.11.4</ironpdf.engine.version>
<ironpdf.engine.version>2024.12.9</ironpdf.engine.version>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion ironpdf-engine-pack/ironpdf-engine-windows-x86/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ironpdf.engine.version>2024.11.4</ironpdf.engine.version>
<ironpdf.engine.version>2024.12.9</ironpdf.engine.version>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.ironsoftware.ironpdf.bookmark.BookmarkManager;
import com.ironsoftware.ironpdf.edit.ChangeTrackingModes;
import com.ironsoftware.ironpdf.edit.PageSelection;
import com.ironsoftware.ironpdf.font.FontTypes;
import com.ironsoftware.ironpdf.form.FormManager;
import com.ironsoftware.ironpdf.headerfooter.HeaderFooterOptions;
import com.ironsoftware.ironpdf.headerfooter.HtmlHeaderFooter;
Expand Down Expand Up @@ -1790,12 +1791,12 @@ public final void replaceText(PageSelection pageSelection, String oldText, Strin
* @param pageSelection The selected page index(es).
* @param oldText Old text to remove.
* @param newText New text to add.
* @param fontName The font to use for the new text (nullable).
* @param customFont The font to use for the new text (nullable).
* @param customFontSize The font size to use for the new text (nullable).
*/
public final void replaceText(PageSelection pageSelection, String oldText, String newText, String fontName, Float customFontSize) {
public final void replaceText(PageSelection pageSelection, String oldText, String newText, FontTypes customFont, Float customFontSize) {
internalPdfDocument.getPageList(pageSelection).forEach(page -> {
Text_Api.replaceTextOnPage(internalPdfDocument, page, oldText, newText, fontName, customFontSize);
Text_Api.replaceTextOnPage(internalPdfDocument, page, oldText, newText, customFont, customFontSize);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class Compress_Api {
*
* @param internalPdfDocument the internal pdf document
* @param quality (1 - 100) to use during compression
* @param scaleToVisibleSize Scale down the image resolution according to its visible size in the PDF document; may cause distortion with some image configurations. Default is false.
* @param scaleToVisibleSize Scale down the image resolution according to its visible size in the PDF document; may cause distortion with some image configurations. Default is false.
*/
public static void compressImages(InternalPdfDocument internalPdfDocument, int quality,
boolean scaleToVisibleSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public final class Setting_Api {

public static IronPdfEngineConnection connectionMode = IronPdfEngineConnection.configure().withSubprocess();

public static final String IRON_PDF_ENGINE_VERSION = "2024.11.4";
public static final String IRON_PDF_ENGINE_VERSION = "2024.12.9";

public static int ironPdfEngineTimeout = 120;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public static String extractAllText(InternalPdfDocument internalPdfDocument,
* @param pageIndex Page index to search for old text to replace
* @param oldText Old text to remove
* @param newText New text to add
* @param fontName The font to use for the new text
* @param customFont The font to use for the new text
* @param customFontSize The font size to use for the new text
*/
public static void replaceTextOnPage(InternalPdfDocument internalPdfDocument, int pageIndex,
String oldText, String newText, String fontName, Float customFontSize) {
String oldText, String newText, FontTypes customFont, Float customFontSize) {
RpcClient client = Access.ensureConnection();

PdfiumReplaceTextRequestP.Builder req = PdfiumReplaceTextRequestP.newBuilder();
Expand All @@ -78,12 +78,12 @@ public static void replaceTextOnPage(InternalPdfDocument internalPdfDocument, in
req.setCurrentText(oldText);
req.setNewText(newText);

if (fontName != null) {
req.setFontName(fontName);
}else{
req.setFontName("TimesNewRoman");
PdfiumFontInfoP fontProto = FontTypes_Converter.toProto(FontTypes.getTimesNewRoman());;
if (customFont != null) {
fontProto = FontTypes_Converter.toProto(customFont);
}

req.setCustomFont(fontProto);

if (customFontSize != null) {
req.setCustomFontSize(customFontSize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.junit.jupiter.api.Test;

import com.ironsoftware.ironpdf.TestBase;
import com.ironsoftware.ironpdf.font.FontTypes;
import com.ironsoftware.ironpdf.internal.staticapi.InternalPdfDocument;
import com.ironsoftware.ironpdf.internal.staticapi.Render_Api;
import com.ironsoftware.ironpdf.internal.staticapi.Text_Api;
Expand All @@ -22,7 +23,7 @@ public final void ExtractAllTextTest() {
@Test
public final void ReplaceTextOnPageTest() throws IOException {
InternalPdfDocument doc = Render_Api.renderHtmlAsPdf("<body><div>AA</div><div>BC</div></body>");
Text_Api.replaceTextOnPage(doc, 0, "AA", "BB", "Helvetica", 25f);
Text_Api.replaceTextOnPage(doc, 0, "AA", "BB", FontTypes.getHelvetica(), 25f);
String text = Text_Api.extractAllText(doc);
Assertions.assertTrue(text.replaceAll("(\\r|\\n)", "").contains("BB"));
}
Expand Down

0 comments on commit a74fd7e

Please sign in to comment.