举例来说,我想加载一个已经存在的 PDF 文件,然后在该 PDF 文件的顶部转置文本并将其再次保存为一个新的 PDF 文件。本质上是将两者合并,一个被换位到另一个上。
我不希望作为背景的 PDF 变成图像而失去质量,因此所有内容都保留其原始矢量格式。
我将如何进行此合并?
我不想使用软件,也许有一个脚本可以做到这一点?
我正在尝试使该示例工作:https : //developers.google.com/analytics/devguides/config/mgmt/v3/quickstart/web-php#enable
我收到的错误是“错误:redirect_uri_mismatch”。
为了安装google api资源,我在以下命令中使用了composer:
php composer.phar require google/apiclient:^2.0.0@RC
Run Code Online (Sandbox Code Playgroud)
这将“ vendor”文件夹安装在我的根站点文件夹中。我的index.php和oauth2callback.php文件位于“ public_html”文件夹中。
这是我进入网站时出现的错误的屏幕截图:
奇怪的是,如果我导航到错误消息“访问......以更新授权的..”中包含的以上链接,则会收到以下错误消息:“ OAuth客户端不存在”
如果单击我唯一可用的客户端ID,则可以导航以查看URI,我还将在下面截屏:
如您所见,在“授权Javascript起源”下,我列出了http:// localhost,在“授权重定向URI”下,我的活动站点后面是“ oauthc2callback.php”文件扩展名。
我不明白如何摆脱我得到的错误。我尝试过替换URI并放入不同的JavaScript来源。
另外,由于最后一个屏幕截图的某种原因,它表示我没有编辑此OAuth客户端的权限,但是我可以进行编辑。
我为index.php提供的代码:
<?php
// Load the Google API PHP Client Library.
require_once '../vendor/autoload.php';
// Start a session to persist credentials.
session_start();
// Create the client object and set the authorization configuration
// from the client_secretes.json you downloaded from the developer console.
$client = new Google_Client();
$client->setAuthConfigFile('../config/client_secrets.json');
$client->addScope('https://www.googleapis.com/auth/analytics.readonly');
// If the user has already authorized this app …Run Code Online (Sandbox Code Playgroud) 我正在尝试从该msdn 资源概述的 Web 配置文件中提取数据。
这是我的代码:
System.Configuration.Configuration activeCampaignApiSetting1 =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null);
if (activeCampaignApiSetting1.AppSettings.Settings.Count > 0) {
System.Configuration.KeyValueConfigurationElement activeCampaignApiKeySetting =
activeCampaignApiSetting1.AppSettings.Settings["ActiveCampaignApiKey"];
if (activeCampaignApiKeySetting != null) {
activeCampaignApiKey = activeCampaignApiKeySetting.Value;
}
System.Configuration.KeyValueConfigurationElement activeCamapignApiUrlSetting =
activeCampaignApiSetting1.AppSettings.Settings["ActiveCampaignApiUrl"];
if (activeCamapignApiUrlSetting != null) {
activeCampaignApiUrl = activeCamapignApiUrlSetting.Value;
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试实例化此类时:
var acs = new Acs(activeCampaignApiKey, activeCampaignApiUrl);
Run Code Online (Sandbox Code Playgroud)
它抛出一个异常,告诉我这些值是空白的。
Web 配置文件中的值如下:
<add key="ActiveCampaignApiKey" value="apikey_removed" />
<add key="ActiveCampaignApiUrl" value="apiurl_removed" />
Run Code Online (Sandbox Code Playgroud)
有人知道我哪里可能出错吗?干杯
编辑:我将"echo($ row)"更改为"print_r($ row)",现在正在下载的csv将每个数组括在括号中,并提供所有提到的数据,但是如何自定义所有数据的打印方式?
现在,它正在打印:
数组([id] => 1 [名字] =>"蒂米")数组(....
(其中每一行是excel电子表格中的下一行)
我如何制作此输出以便每条记录都有自己的行?例如,excel中的第一列是id,那么第二列是firstname,每条记录都是自己的行?
我的main.php中有一个链接:
<a class="btn" href="export.php">Export</a>
Run Code Online (Sandbox Code Playgroud)
那么这是我的export.php文件:
<?php
//open database connection
try {
$db = new PDO('mysql:host=localhost;dbname=DBNAME;charset=utf8',
'DBUSER',
'DBPASS');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch(PDOException $ex) {
echo "did not connect...";
}
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=exported-data.csv');
$sql = "SELECT * FROM table_name;";
$sth = $db->prepare($sql);
$sth->execute();
$filename = date('d.m.Y').'.csv';
$data = fopen($filename, 'w');
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
fputcsv($data, $row);
print_r($row);
}
echo "\r\n";
fclose($data);
?>
Run Code Online (Sandbox Code Playgroud)