Skip to content

Commit

Permalink
Merge pull request #12 from iron-software/automate-merge-code
Browse files Browse the repository at this point in the history
Copy from IronPolyglot on 2023-07-06
  • Loading branch information
ikkyuland authored Jul 6, 2023
2 parents b57a1e3 + 53cc554 commit 3029977
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 52 deletions.
2 changes: 2 additions & 0 deletions IronPdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<createSourcesJar>true</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
Expand Down
65 changes: 32 additions & 33 deletions IronPdf/src/main/java/com/ironsoftware/ironpdf/PdfDocument.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ironsoftware.ironpdf.edit;

import com.google.common.collect.Lists;
import com.ironsoftware.ironpdf.internal.staticapi.InternalPageSelection;
import com.ironsoftware.ironpdf.internal.staticapi.InternalPdfDocument;
import com.ironsoftware.ironpdf.internal.staticapi.Page_Api;

Expand All @@ -14,9 +15,9 @@
* <p>PageSelection can be used to perform operations on a subset of pages from a PDF document.</p>
* <p>See: {@link com.ironsoftware.ironpdf.PdfDocument}</p>
*/
public class PageSelection {
public class PageSelection extends InternalPageSelection {


private List<Integer> pagesList = new ArrayList<>();

/**
* Every page of the PDF.
Expand Down Expand Up @@ -86,20 +87,7 @@ public static PageSelection pageRange(List<Integer> pageList) {
return ps;
}

/**
* Gets page list.
*
* @param internalPdfDocument the internal pdf document
* @return the page list
*/
public List<Integer> getPageList(InternalPdfDocument internalPdfDocument) {
return pagesList.stream().map(i->{
if(i == -1){
return Page_Api.getPagesInfo(internalPdfDocument).size() - 1;
}
return i;
}).collect(Collectors.toList());
}


/**
* Sets page list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final void flatten() {
* @param pageSelection Selected page indexes. Default is all pages.
*/
public final void flatten(PageSelection pageSelection) {
Form_Api.flattenPdfFrom(internalPdfDocument, pageSelection.getPageList(internalPdfDocument));
Form_Api.flattenPdfFrom(internalPdfDocument, internalPdfDocument.getPageList(pageSelection));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.ironsoftware.ironpdf.internal.staticapi;

import java.util.ArrayList;
import java.util.List;

public class InternalPageSelection {
protected List<Integer> pagesList = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ironsoftware.ironpdf.internal.staticapi;


import com.ironsoftware.ironpdf.edit.PageSelection;
import com.ironsoftware.ironpdf.internal.proto.EmptyResult;
import com.ironsoftware.ironpdf.page.PageInfo;

Expand All @@ -14,6 +15,7 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
* The type Internal pdf document. For users, please use {@link com.ironsoftware.ironpdf.PdfDocument} instead.
Expand Down Expand Up @@ -83,4 +85,18 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throw new PrinterException(e.getMessage());
}
}

/**
* Gets page list.
* @param pageSelection PageSelection
* @return the page list
*/
public List<Integer> getPageList(PageSelection pageSelection) {
return pageSelection.pagesList.stream().map(i->{
if(i == -1){
return Page_Api.getPagesInfo(this).size() - 1;
}
return i;
}).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class SecurityOptions {
*/
private String ownerPassword;
/**
* Sets the user password and enables 128Bit encryption of PDF content. <p>A user password if a
* Sets the user password and enables 128Bit encryption of PDF content. <p>A user password is a
* password that each user must enter to open or print the PDF document.</p>
*/
private String userPassword;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class Stamper {
*/
private Length horizontalOffset = new Length();
/**
* The horizontal offset. Default value is 0, and default unit is
* The vertical offset. Default value is 0, and default unit is
* {@link MeasurementUnit#PERCENTAGE}. Value of 0 has no effect. Positive indicates an
* offset in the downward direction. Negative indicates an offset in the upward direction.
*/
Expand Down

0 comments on commit 3029977

Please sign in to comment.