Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
io.fluidsonic.pdf:fluid-pdf-jvm
Advanced tools
Easy PDF generation with HTML & CSS using Chromium or Google Chrome
Easy PDF generation with HTML & CSS using Chromium or Google Chrome
build.gradle.kts
:
dependencies {
implementation("io.fluidsonic.pdf:fluid-pdf:0.20.0")
}
import io.fluidsonic.pdf.*
import java.nio.file.*
suspend fun main() {
// TODO Change the binary file path to your local Chromium or Google Chrome installation.
val sourceFile = Path.of("input.html").toAbsolutePath()
val destinationFile = Path.of("output.pdf").toAbsolutePath()
ChromiumPdfGenerator.launch(
binaryFile = Path.of("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
).use { generator ->
generator.generate(PdfGenerationSource.HtmlFile(sourceFile))
.writeTo(destinationFile)
}
println("PDF has been generated at $destinationFile")
}
ChromiumPdfGenerator.launch()
to launch a browser instance for PDF generation.ChromiumPdfGenerator.lazy()
to launch the browser not immediately but automatically with the first PDF generation.ChromiumPdfGenerator
's .close()
to shut down the browser when you are done generating PDFs.PdfGenerator
's .generate()
to create any number of PDFs.PdfGenerator
interface to hide implementation details (use of Chromium, .close()
) as needed.generator.generate(PdfGenerationSource.Html("<strong>Hello world!</strong>"))
.writeTo(PdfGenerationDestination.File(destinationFile))
💡 Relative paths in HTML & CSS won't resolve. Using <base href="…">
to specify the base path should help.
val sourceStream: InputStream = …
generator.generate(PdfGenerationSource.HtmlStream(sourceStream))
.writeTo(PdfGenerationDestination.File(destinationFile))
💡 Relative paths in HTML & CSS won't resolve. Using <base href="…">
to specify the base path should help.
generator.generate(
source = PdfGenerationSource.Html("<strong>Hello world!</strong>"),
settings = PdfGenerationSettings.default.copy(
encryption = PdfEncryption(
ownerPassword = "secret",
permissions = PdfPermissions.none.copy(
contentExtractionAllowed = true,
contentExtractionForAccessibilityAllowed = true,
printQuality = PdfPermissions.PrintQuality.high,
),
),
includeBackgrounds = false,
metadata = PdfMetadata(
title = "My PDF"
),
pageMargins = PdfMargins.cm(top = 2.0, right = 2.0, bottom = 1.0, left = 2.0),
pageOrientation = PdfOrientation.landscape,
pageSize = PdfSize.A5,
preferCssPageSize = false
)
)
.writeTo(destinationFile)
generator.generate(PdfGenerationSource.Html("<strong>Hello world!</strong>"))
.writeTo(outputStream)
💡 Closing the output stream is the responsibility of the caller. It will not be closed automatically.
Contributions welcome 🙏
.generate()
works well if used from multiple threads and document if that is the case.Apache 2.0
FAQs
Unknown package
We found that io.fluidsonic.pdf:fluid-pdf-jvm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.