我正在尝试将高质量的图像放入PDF(每页一个).但如果我将页面大小设置为a4,我必须调整我的图片大小,因为它们太大了.然后他们失去了质量.有没有办法将大图像放到A4页面而不会失去质量?
我正在使用iTextSharp库,首先我正在创建文档
document = new Document(PageSize.A4, 0, 0, 0, 0);
FileStream output = new FileStream(pdfPath + "document.pdf", FileMode.Create);
PdfWriter writer = PdfWriter.GetInstance(document, output);
document.Open();
Run Code Online (Sandbox Code Playgroud)
然后我要添加每张图片
document.Add(iTextSharp.text.Image.GetInstance(toSaveImage, System.Drawing.Imaging.ImageFormat.Tiff));
Run Code Online (Sandbox Code Playgroud)
并关闭文件
document.Close();
Run Code Online (Sandbox Code Playgroud) 我想实施一个工厂.在我的应用程序中只有一个这个工厂的实例.我的工厂需要在创建第一个MyObject之前做一些准备,然后才开始.有没有更好的方法来做到这一点
object MyObjectFactory {
private var isApplied:Boolean = false
def apply() = {
if(!isApplied) {
isApplied = true;
onLoad
}
//do something
new MyObject
}
def onLoad {
//prepare environment
}
}
Run Code Online (Sandbox Code Playgroud) 这段代码似乎不安全:
<form method='post'>
<input type='text' name='x' style='width:1000px'>
<input type='submit' value='Send'>
</form>
<?php
if(isset($_POST['x']))
{
require_once("db_connect.php");
$q = mysqli_query($dbc, "SELECT x FROM table where x = '". $_POST['x'] ."'");
while($r = mysqli_fetch_assoc($q))
echo $r['x'];
}
Run Code Online (Sandbox Code Playgroud)
但是当我发送恶意输入时,它没有用.所以我制作了类似的剧本:
<form method='post'>
<input type='text' name='x' style='width:1000px'>
<input type='submit' value='Send'>
</form>
<?php
if(isset($_POST['x']))
echo $_POST['x'];
Run Code Online (Sandbox Code Playgroud)
当我发送'(撇号)时,我收到了\'.所以它会自动转义.我的问题是,它发生在哪里?如何发送'清除'撇号?