• EnglishSpanishGermanFrenchPolishChinese (Traditional)


EnglishSpanishGermanFrenchPolishChinese (Traditional)

Operating systems, scripting, PowerShell and security

Operating systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Crear un PDF utilizando PowerShell

Descargar el fichero iTextSharp, a .NET PDF library para poder crear el PDF

https://sourceforge.net/projects/itextsharp/files/latest/download?source=files

Crear el fichero PDF desde PowerShell

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#Descargar https://sourceforge.net/projects/itextsharp/
 
[System.Reflection.Assembly]::LoadFrom("E:\programas\itextsharp-dll-core\itextsharp.dll")
 
$document=New-Object itextsharp.text.document
$stream=[IO.File]::OpenWrite("output.pdf")
[itextsharp.text.pdf.PdfWriter]::GetInstance($document, $stream)
 
$document.Open()
Get-Content file.txt | %{
$line=New-Object itextsharp.text.Paragraph($_)
$document.Add($line)
}
 
$document.Close()
$stream.Close()

Publicado el día 17 de agosto de 2017

CATEGORÍAS

PowerShell

ETIQUETAS

.NET, Download, Get-Content, HTTP, HTTPS, iTextsharp, Jesús Niño Camazón, New-Object, PDF, Reflection.Assembly, Source, System.Reflection.Assembly

MÁS

  • 11. Gestión del Directorio Activo (nivel intermedio)
  • Ejercicios de seguridad: realizar una comunicación UDP segura (utilizando Cryptographic Message Syntax)
  • Buscar el nombre de una clase de un formulario en PowerShell con Microsoft Spy++ y escribir un mensaje en una caja de texto desde PowerShell
  • Insertar en una base de datos las noticias de una página web (crear la base de datos y la tabla)
  • Convertir un script de PowerShell en un ejecutable de Windows (convertir un formulario en PowerShell)
  • Ejercicios de seguridad: práctica sobre virus